Combining Rectangles#4109

Combining Rectangles

1 saniye
64 megabayt
Kolay

Given rectangles with sides aligned to the coordinate axes, your task is to calculate the area of the shape formed by the union of these rectangles.

Keep in mind that the resulting shape may consist of separate parts.

Giriş

The first line contains the integer (1 \le N \le 100), representing the number of rectangles. The following lines each contain integers: x_1, y_1, x_2, y_2, which are the coordinates of two opposite corners of a rectangle. The coordinates are integers and can range up to in absolute value.

Çıktı

Output the total area of the figure formed by the union of the rectangles.

Explanation for example 1:

Örnekler

Örnek 1

Loading
Loading