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:
Input The input contains a set of cases. Each case specifies the number of circles, n≥ 0, and the number of random points generated for the Montecarlo approximation. After that, a list of n circles is specified, each one with the coordinates of the center, (x,y), and the radius. The coordinates and the radius are real numbers.
Output For every case print the estimated area as a real number in free format.
Observation 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