Monitoring System#3790

Monitoring System

10 δευτερόλεπτα
64 megabyte
Πολύ δύσκολο

BCBC is a large bank. To ensure safety, they have set many cameras to monitor the total bank. Recently, they have found some problems in the monitoring system. In the current system, a camera can monitor a rectangle region. Some regions can be monitored by three or more cameras, which is waste; some regions can only be monitored by just one camera, which is not safe. So the management intends to improve the system. Now he wants to know the area of regions monitored by just two cameras.

Είσοδος

There are multiple test cases. Each test case begins with an integer (1 \le n \le 100000) standing for the number of cameras. Then lines follow. Each line has four integers x_1, y_1, x_2, y_2 (1 < x_1, x_2, y_1, y_2 < 10^9). The four integers describe the rectangle region one camera can monitor, (x_1, y_1) is the left bottom coordinate and (x_2, y_2) is the top right coordinate.

Έξοδος

Each test case output one integer that is the area of regions covered by just exactly two cameras, the result occupied one line.

Παραδείγματα

Παράδειγμα 1

Loading
Loading