#icpc2014springb. [icpc2014spring_b]Cube Coloring
[icpc2014spring_b]Cube Coloring
MathJax.Hub.Config({ tex2jax: { inlineMath: [[""], ["\\(","\\)"]], processEscapes: true }}); blockquote { font-family: Menlo, Monaco, "Courier New", monospace; color: #333333; display: block; padding: 8.5px; margin: 0 0 9px; font-size: 12px; line-height: 18px; background-color: #f5f5f5; border: 1px solid #ccc; border: 1px solid rgba(0, 0, 0, 0.15); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; white-space: pre; white-space: pre-wrap; word-break: break-all; word-wrap: break-word; }
Problem Statement
Great painter Cubic is famous for using cubes for his art. Now, he is engaged in a new work of art. He tries to form an rectangular parallelepiped by arranging and piling up many cubes such that the adjacent surfaces of cubes are fully shared.
Of course, he won't finish his work only arranging and piling up cubes. The position of each cube is denoted by through as by the ordinary coordinate system, and Cubic calls the cube the origin cube. Then, he paints a pattern on the rectangular parallelepiped with different colors according to the distance between each cube and the origin cube. He paints all cubes regardless of whether or not a cube is visible externally. This is his artistic policy. He uses Manhattan distance as the distance between cubes. The Manhattan distance between two cubes and is defined as .
On the current work, Cubic decides to use colors, which are numbered from to . He paints a cube with the -th color if the distance between the cube and the origin cube satisfies .
Cubic wants to estimate the consumption of each color in order to prepare for the current work. He asks a great programmer, you, to write a program calculating the number of cubes that will be painted by each color.
Input
The input contains seven integers , , , , , , and . All integers are in one line and separated by a single space. Three integers , , and () represent the length of each side of the rectangular parallelepiped that Cubic tries to form. Three integers , , and (, , ) represent the position of the origin cube. The number of kinds of colors is denoted by ().
Output
The output contains integers in one line. The -th integer () represents the number of the cubes that will be painted by the -th color. All integers must be separated by a single space.
Sample Input 1
2 2 2 0 0 0 5```
### Output for the Sample Input 1
```plain
1 3 3 1 0```
* * *
### Sample Input 2
```plain
4 3 3 1 1 1 3```
### Output for the Sample Input 2
```plain
13 10 13```
* * *
### Sample Input 3
```plain
2000 2000 2000 1000 1000 1000 1```
### Output for the Sample Input 3
```plain
8000000000```
* * *
### Source Name
[Japan Alumni Group Spring Contest 2014](http://acm-icpc.aitea.net/index.php?2013%2FPractice%2F%BD%D5%A5%B3%A5%F3%A5%C6%A5%B9%A5%C8%2F%B0%C6%C6%E2)
* * *