cho.sh
Notes
Loading...

Union Area of Right Isosceles Triangles

Time limit

2s

Memory limit

128 MB

Problem

You are given (n) right isosceles triangles on a plane. Each triangle is described by three integers (x), (y), and (m) ((m>0)); its vertices are ((x, y)), ((x+m, y)), and ((x, y+m)).

The triangles may overlap. Write a program that computes the area covered by at least one triangle.

Input

The first line contains an integer (n). ((1 \le n \le 2{,}000))

Each of the next (n) lines contains three integers (x), (y), and (m), describing one triangle. The absolute values of (x) and (y) do not exceed (10{,}000{,}000), and (m) is between (1) and (1{,}000), inclusive.

Output

Print the area covered by all triangles on the first line. The output must always include exactly one digit after the decimal point.

Hint

Because all coordinates and side lengths are integers, the area is always representable in units of (0.5).