Mirko washed his sheets and is on his way to hang them to dry in front of his house. However, strong winds have pulled the clothesline out of the ground so Mirko temporarily laid out the sheets on the grass.
The grass field can be modeled by an infinite square grid, where every unit square is represented by a pair of coordinates. Sheets are rectangles in the grid with sides parallel to the coordinate axes. Sheets may overlap.
In an effort to put his clothesline back up, Mirko slammed a pole into
the ground at coordinates
Time is measured from the moment the oil starts spreading - at time zero
only square
The grass field from the first example after zero, one and two seconds.
Write a program that, given
Input Specification
The first line contains an integer
Each of the following
The next line contains an integer
The next line contains
Output Specification
For each of the time points, output on a separate line the total area of stained fabric on all sheets, in the order the time points are given in the input.
Sample Input 1
3
-2 1 1 2
1 0 2 1
-3 -3 -2 0
2
1 2
Sample Output 1
5
15
Sample Input 2
4
5 1 8 4
-8 1 -5 4
-10 2 10 3
6 0 8 10
6
1 2 3 4 7 9
Sample Output 2
0
5
14
18
70
100
Sample Input 3
1
1 1 1000000 1000000
3
100 10000 1000000
Sample Output 3
10000
100000000
1000000000000
Comments