SKTRIXOR - Xor

no tags 

 

Mirko and Slavko have built their own LED display. The display is initially
white. During each of the N parts of the testing phase, Mirko attached three
electrodes to the display in such way that they formed a right isosceles
triangle. He noticed that, after attaching the electrodes, all pixels in the
enclosing triangle are inverted (white pixels become black, and black pixels
become white).
Watching Mirko play with the electrodes, Slavko observed interesting shapes
emerging on the screen. Mathematically inclined as he is, first thing that
crossed his mind was how to calculate total area covered by black pixels. Help
him by writing a program to do just that!
INPUT
First line of input contains an integer N (1 ≤ N ≤ 10), number of triangles
formed by Mirko's fiddling with electrodes. Each of the following N lines
contains three integers X, Y and R (1 ≤ X, Y, R ≤ 106
), describing a triangle.
(X, Y) are the coordinates of the lower left corner of the triangle, while R
represents the length of the two sides of the triangle.

Mirko and Slavko have built their own LED display. The display is initially white. During each of the N parts of the testing phase, Mirko attached three electrodes to the display in such way that they formed a right isosceles triangle. He noticed that, after attaching the electrodes, all pixels in the enclosing triangle are inverted (white pixels become black, and black pixels become white).

Watching Mirko play with the electrodes, Slavko observed interesting shapes emerging on the screen. Mathematically inclined as he is, first thing that crossed his mind was how to calculate total area covered by black pixels. Help him by writing a program to do just that!

INPUT

First line of input contains an integer N (1 ≤ N ≤ 10), number of triangles formed by Mirko's fiddling with electrodes. Each of the following N lines contains three integers X, Y and R (1 ≤ X, Y, R ≤ 10^6 ), describing a triangle. (X, Y) are the coordinates of the lower left corner of the triangle, while R represents the length of the two sides of the triangle.

OUTPUT

The first and only line of output should contain the area covered by black pixels, rounded to one decimal place.

SAMPLE TEST CASES

Input:

3

1 1 2

7 1 6

5 3 4

Output:

24.0

Input:

5

5 5 99

5 5 99

5 5 99

5 5 99

5 5 99

Output:

4900.5

Input:

4

5 5 99

5 5 99

5 5 99

5 5 99

Output:

0.0



Added by:Nhung anh sao dem
Date:2013-10-29
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:COCI 09/10 Contest #6