Build the Park I

Time Limit: 2 Seconds
Memory Limit: 65536 KB

The developers got a wonderful rectangular field with length `n` meters and width `m` meters. They wanted to build a theme park on this field. First of all, they had to level this field. A group of surveyors made a survey of this field. Firstly, they divide the rectangle field into many small squares. The method is like this: divide the length equally into `n` pieces, and divide the width equally into `m` pieces. Then the field would be divided into `n*m` small squares whose size were 1 meter * 1 meter. Then the surveyors measured the elevations of the four corners and the center of these little squares. Now, if we connected the center and the four corners of each little square, the field would be divided into many triangles. We can regard this field being consisted by many truncated triangular prisms, so that some parameters, such as the volume, can be easily calculated. The architect designed that the field should be leveled to meet the elevations of `h`. The civil engineer was ordered to calculate how much clay should be digged out and how much clay should be filled in. He found it difficult to finish this mission by hand. Can you help him?

#### Input

There are several test cases.

For each test case:

The 1st line contains two integers `n` and `m`, indicating the length and the width of the field.(0 < `n,m` <= 100)

The 2nd line contains one real number `h`, indicating the elevation of the field should be level to reach.

For the next `n + 1` lines, each line contains `m + 1` numbers, indicating the elevation of each corner of the little squares which mentioned above.

For the next `n` lines, each line contains `m` numbers, indicating the elevation of each center of the little squares.

#### Output

For each test case, you should output one line, contains two real number separated by a single space, first number is the volume of the clay should be digged out, and the second number is the volume of the clay should be filled in. Each of the numbers should be round to 3 digits after decimal point.

#### Sample Input

1 1
1.5
1.5 2.5
0.5 1.5
1.5
1 1
1.2
1.5 2.5
0.5 1.5
1.5

#### Sample Output

0.167 0.167
0.357 0.057

Author:

**LI, Tierui**
Submit
Status