# 1056 : Tetrahedrons and Spheres

Time Limit: 1 Sec Memory Limit: 128 Mb Submitted: 2 Solved: 2## Description

There are a tetrahedrons and b spheres in the 3D-splace, you’re asked to calculate the volume occupied by at least one of them (i.e. volume of the union of the objects).

## Input

There will be at most 20 test cases. Each case begins with two integers a, b, the number of tetrahedrons and the number of spheres (1<=a,b<=5). The next a lines each contains 12 integers: x_{1}, y_{1}, z_{1}, x_{2}, y_{2}, z_{2}, x_{3}, y_{3}, z_{3}, x_{4}, y_{4}, z_{4}, the coordinates (x_{i}, y_{i}, z_{i})(1<=i<=4) of the four vertices of a tetrahedron. The next b lines each contains 4 integers x, y, z, r, the coordinates of the center (x, y, z) and the radius r (r<=3). All the coordinate values are integers with absolute values no more than 5. The input is terminated by a=b=0.

## Output

For each test case, print a single line, the volume occupied by at least one of them, rounded to three decimal points.

## Sample Input

1 1 0 0 4 1 0 4 0 1 4 0 0 5 0 0 0 1 0 0

## Sample Output

4.356

## Hint

## Author

SRbGa