#ds303. 矩形面积并
矩形面积并
Rectangle Area Union
Problem Description
There are rectangles on the plane, i.e. rectangles whose lower-left corner is and upper-right corner is . What is the area of their union?
Input Format
The first line contains an integer ().
The next lines each contain four integers ($1\leq X_1 \leq X_2 \leq 10^9,\ 1\leq Y_1 \leq Y_2 \leq 10^9$).
Note: empty rectangles may be present.
Output Format
Output one number, the answer.
Sample Input
2
1 4 2 3
2 3 1 4
Sample Output
5