|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||32 MB||0||0||0||0.000%|
Once there was a famous sailing ship contest called SEJLY. Every year many experienced sailors competed in it. For this year the annual 100th SEJLY is planned and its organizers want to have more competing sailors than ever. So they have decided to make billboards with a nice photo from the previous year to attract new sailors. Unfortunately this year the price of green color has extremely increased and unfortunately it is also the color of all the sails. So they need to count how much green color is needed for a single billboard and thence also how many billboards they can afford. Fortunately the rules of the SEJLY are very restrictive — all the sails must be right-angled isosceles triangles. To make things easier you know that the coordinates of the vertices of all the sails (triangles) are integers. So they ask you — the young promising programmers — to help them with the problem. Your task is to compute the area of all the sails on the billboard. In other words you are given a set of isosceles right-angled triangles with integer coordinates, having legs parallel to the coordinate axis and hypotenuses going "from upper left to lower right" and you are to output area of their union.
On the first line there is a number n (1 ≤ n ≤ 10 000) — the number of triangles. Following n lines will contain three space-separated integers x, y, d describing each triangle. A 3-tuple x, y, d corresponds to a triangle ABC with the following coordinates: A = [x, y], B = [x + d, y], C = [x, y + d]. You may assume that 0 ≤ x, y, d ≤1 000 000.
It will consist of a single number u — the area of the union of given triangles. It should be printed with exactly one digit after the decimal point. You may assume that u < 231.
3 1 1 4 2 0 2 3 2 2