National Olympiad in Informatics, China, 1997
SERCOI (Space-Earth Resource Cover-Observe Institute) is an organization committed to using satellite technology and the Earth's resources for observation and research. They have successfully built a new satellite model, the SERCOI-308. This satellite can provide coverage to a cube-shaped region of a certain volume while being situated at the cube's center.
The Cartesian coordinates
Since the region that any satellite can cover is limited, multiple satellites can work together to cover certain regions. The spaces where they can cover may overlap, as shown in the given diagram (the shaded sections indicate overlapping coverage).
Please write a program that, given the states of many satellites, calculates the total volume being covered.
Input Specification
The first line of input will contain one integer
Output Specification
The output should contain one line with one integer, the total volume covered by all of the satellites.
Sample Input
3
0 0 0 3
1 -1 0 1
19 3 5 6
Sample Output
1944
Problem translated to English by .
Comments