Venue Rental (Small)

Given up to 100 axis-aligned rectangles, find the area of the union of all rectangles.

Medium4ArrayImplementationSimulationGeometryInterviewNo attempts yetTime limit2sMemory limit256 MB

Problem

Sanghyun is about to leave for military service and wants to throw a farewell party. He rents a venue for it, and the rental company is unusual because only former programmers work there.

Once Sanghyun picks the place he wants, the company builds NN rectangles that cover that place completely. It then tells him the number of rectangles NN and, for each rectangle, the coordinates of its bottom left corner and its top right corner. The NN rectangles may overlap partially or completely. Every rectangle has sides parallel to the coordinate axes.

Write a program that computes the area of the venue Sanghyun rented, that is, the area of the region covered by at least one of the NN rectangles.

Input

The first line contains the number of rectangles NN (2N1002 \le N \le 100).

Each of the next NN lines contains four integers x1x_1, y1y_1, x2x_2, y2y_2 (0x1<x25000 \le x_1 < x_2 \le 500, 0y1<y25000 \le y_1 < y_2 \le 500) separated by spaces. The bottom left corner of that rectangle is (x1,y1)(x_1, y_1) and the top right corner is (x2,y2)(x_2, y_2).

Output

Print the area of the venue Sanghyun rented on the first line. The area is always an integer, so print it without a decimal point.