#Lutece2281. 白给的几何题1

白给的几何题1

Migrated from Lutece 2281 白给的几何题1

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

给出 nn 个矩形的左下角和右上角的坐标,求矩形面积的并。

矩形面积并指的是被矩形覆盖到的面积和,重叠部分仅算一次。

Input

多组输入,每组首先一个整数 nn,代表矩形的数量;

接下来 nn 行,每行四个整数 x1,y1,x2,y2x_1,y_1,x_2,y_2,代表每个矩形的左下角坐标为 (x1,y1)(x_1,y_1),右上角坐标为 (x2,y2)(x_2,y_2)

n=0n=0 时读入结束。

Output

每组一行一个数字,表示矩形面积的并。

Samples

1
0 0 10 10
2
0 0 10 10
5 5 6 6
0
100
100

Note

保证单测试点数据组数不超过 300300 组。对于每组数据,$1\le n\le 10^5,1\le x_1<x_2\le 10^5,1\le y_1<y_2\le 10^5$

Resources

2019 UESTC ACM Training for math and geometry