Area covered by squares

Compute the total area covered by up to nine rotated squares given by center and vertex, counting overlaps once.

Medium7GeometryCombinatoricsNo attempts yetTime limit2sMemory limit256 MB

Problem

NN squares lie in the plane. Each square is given by the coordinates of its center and the coordinates of one of its vertices. Rotating the given vertex around the center by 9090, 180180 and 270270 degrees produces the other three vertices, so the two points determine one square.

Write a program that computes the area of the region covered by at least one square. A part where several squares overlap counts once.

Input

The first line holds the integer NN, the number of squares. (0<N<100 < N < 10)

Each of the next NN lines holds four integers separated by spaces and describes one square. The first two are the xx and yy coordinates of the center, the last two are the xx and yy coordinates of one vertex.

All coordinates are integers in the range [50,50][-50, 50], and the vertex differs from the center.

Output

Print one line holding the area covered by the squares, rounded to the nearest integer. If the fractional part of the area is exactly 0.50.5, round up.