Combining rectangles is much easier when its sides are parallel to the coordinate axes. Find the total area covered by a given set of rectangles.
The first line contains the number of rectangles n (2 ≤ n ≤ 3). Each of the next n lines contains coordinates of opposite corners of rectangle in format: x[1] y[1] x[2] y[2]
. The coordinates are integers in the range [-10^9
, 10^9
].
The rectangles can be degenerated.
Print the total area covered by the given set of rectangles, rounded to the nearest integer.