#P7762. [COCI 2016/2017 #5] Unija

[COCI 2016/2017 #5] Unija

Description

Given NN rectangles whose geometric centers are at the origin of the Cartesian coordinate system. Paint these NN rectangles, and find the total painted area.

Input Format

The first line contains an integer NN.

The next NN lines each contain two even integers X,YX, Y, representing the rectangle’s width and height (corresponding to the horizontal length and the vertical length, respectively).

Output Format

Output the total painted area.

3
8 2
4 4
2 6
28
5
2 10
4 4
2 2
8 8
6 6
68

Hint

[Sample 1 Illustration]

[Constraints]

For 40%40\% of the testdata, all input integers are less than 33333333.

For 50%50\% of the testdata, there are no rectangles that contain another.

For 100%100\% of the testdata, 1N1061 \le N \le 10^6, 2X,Y1072 \le X, Y \le 10^7.

[Hints and Notes]

This problem is translated from COCI 2016-2017 CONTEST #5 T3 Unija.

The score of this problem follows the original COCI settings, with a full score of 100100.

Translated by ChatGPT 5