We want to calculate the area of the union of a set of circles. This is a problem that has some non-trivial algorithm for the exact computation. Instead, we would be satisfied by finding an approximation using a Montecarlo method. The ideas is as follows:
Calculate a bounding box around the circles.
Generate random points within the bounding box.
Count how many points are inside some circle.
The input contains a set of cases. Each case specifies the number of circles, , and the number of random points generated for the Montecarlo approximation. After that, a list of circles is specified, each one with the coordinates of the center, , and the radius. The coordinates and the radius are real numbers.
For every case print the estimated area as a real number in free format.
There is no need to compute the exact area. The output will be considered correct if it is a good approximation of the area.
Input
1 1000000 0 0 1 2 1000000 0 0 1 0 0 0.5 4 1000000 0 0 2 1 1 3 -1 1 4 0 -1.5 2.5
Output
3.143352 3.141936 59.374215