1203 - Union

Time Limit: 5s Memory Limit: 128MB

Submissions: 239 Solved: 38
Description
Given two balls in 3D space, you are asked to calculate the volume of their union, ie the total volume.
Input
There multiple cases: Each case contains two lines: 1st-line: x1, y1, z1, r1 2nd-line: x2, y2, z2, r2 Each line specifies the coordinate and the radius of a ball. The input file termitates with EOF. All the data in the input are integers in [-20, 20].
Output
A single number: the volume of the union with a precision of 3 numbers after the decimal point.
Sample Input
0 0 0 1

0 0 2 1
Sample Output
8.378

Hint
Source
Isun