P17221 [ICPC 2017 Nanning R] Resonators
Description
:::align{center}

:::
The Sun-glade Isle as a portal is an important military fortress, located in the East China Sea. Several finest agents climbed onto the island successfully. They captured the portal and declared the victory of the battle, temporarily.
To reinforce the portal, they deployed $N$ resonators around the portal. The centre of the portal is located at $(0, 0)$. A resonator occupies a circular area. The centre of the $i$-th one is $(x_i, y_i)$ and its radius is $r_i$. These circular areas are likely to overlap.
The total defense capability is the sum of squared distances to the centre of the portal $(0,0)$ from the locations which be occupied by at least one resonator. That is say that if there is a sufficient small region occupied by at least one resonator, this region would offer the defense capability up to the product of the area, and the squared distance to the centre $(0, 0)$.
If we suppose $\Omega$ as the union of all resonators which is the union of several circles. The total defense capability of this portal is actually the result of the following integral:
$$ \int_{\Omega} |v|^2 ds = \int_{\Omega}{(x^2 + y^2)} dx dy. $$
Here is your mission, as a super leader the Intel. Compute the total defense capability of this portal.
Input Format
The input contains several test cases and the first line of input gives the number of test cases which is up to $50$.
For each test case, the first line contains the integer $N (N \le 1000)$ which is the total number of resonates deployed. The following $N$ lines describe these resonators and the $i$-th line contains three integers $x_i$, $y_i$ and $r_i$, where $|x_i|, |y_i| \le 100$ and $1 \le r_i \le 5$.
Output Format
For each test case output the defense capability rounding up to three decimal places.
Explanation/Hint
For the first test case in the sample, the answer if
$$ \int_{-1}^{1} \int_{ \sqrt{1-x^2} }^{\sqrt{1-x^2}} (x^2+y^2) = \frac{\Pi}{2} \approx 1.5708 $$
The answer of the second test case is the sum of
$$ \int_{-1}^{1/2} \int_{ \sqrt{1-x^2}}^{\sqrt{x-x^x}} (x^x+y^2)dydx \approx 1.15545 $$
and
$$ \int_{1/2}^{2} \int_{ \sqrt{1-(x-1)^2} }^{\sqrt{1-(x-1)^2}} (x^2+y^2)dydx \approx 4.54888 $$