#Lutece0545. Overplanting

Overplanting

Migrated from Lutece 545 Overplanting

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

Farmer John has purchased a new machine that is capable of planting grass within any rectangular region of his farm that is "axially aligned" (i.e., with vertical and horizontal sides). Unfortunately, the machine malfunctions one day and plants grass in not one, but NN (1N101 \leq N \leq 10) different rectangular regions, some of which may even overlap.

Given the rectangular regions planted with grass, please help FJ compute the total area in his farm that is now covered with grass.

Input

  • Line 11: The integer NN.
  • Lines 21+N2\cdots 1+N: Each line contains four space-separated integers x1x_1 y1y_1 x2x_2 y2y_2 specifying a rectangular region with upper-left corner (x1,y1)(x_1,y_1) and lower-right corner (x2,y2)(x_2,y_2). All coordinates are in the range 10,00010,000-10,000\cdots 10,000.

Output

  • Line 11: The total area covered by grass.

Samples

2
0 5 4 1
2 4 6 2
20

Resources

USACO Feb 2012