Code Submission Evaluation System Login

CSES Problem Set

Area of Rectangles


Task | Statistics


CSES - Area of RectanglesCSES - Area of Rectangles

Time limit:1.00 s Memory limit:512 MB

Given $n$ rectangles, your task is to determine the total area of their union.

Input

The first input line has an integer $n$: the number of rectangles.

After that, there are $n$ lines describing the rectangles. Each line has four integers $x_1$, $y_1$, $x_2$ and $y_2$: a rectangle begins at point $(x_1,y_1)$ and ends at point $(x_2,y_2)$.

Output

Print the total area covered by the rectangles.

Constraints
Example

Input:
3
1 3 4 5
3 1 7 4
5 3 8 6


Output:
24