Union of rectangles is much easier when their sides are parallel to the coordinate axes. Find the union of the given set of rectangles.
The first line contains the number of rectangles n (2 ≤ n ≤ 15). Each of the next n lines gives the coordinates of opposite corners of one rectangle in format x[1] y[1] x[2] y[2]
. All coordinates are integers and belongs to segment [-10^9
, 10^9
].
The rectangles can be irregular.
Print the area of union of rectangles.