IOI '05 - Nowy Sacz, Poland
Three children are building the Polish flag from square blocks. The flag
will be a rectangle,
The children are laying blocks in turns. In the first turn, Lucy puts her
block on the left edge at position
Every next turn they lay blocks as follows. The child can put a block in a given slot only if the slot is empty and the block to be put would be adjacent to one of the blocks put in the preceding turn. (Two blocks are adjacent if they have a common side.) In a given turn the child puts as many blocks as possible. Only one block can be put into a single slot. If two or more children want to put a block into the same slot in the same turn then the highest priority has Lucy, then Bob and the lowest priority has Roy.
Before the children start building the flag they have to distribute blocks. Here is the problem. They don't know how many blocks of each color they need. Help the children and compute for each child the number of blocks of each color he/she will use while building the flag.
Input Specification
The first and only line contains four integers
Output Specification
Output should consist of a single line containing six integers separated by single spaces. The first and the second integer should be the number of white and red blocks respectively, which Lucy needs; the third and fourth number should be the number of white and red blocks respectively, which Bob needs; the fifth and sixth number should be the number of white and red blocks respectively, which Roy needs.
Sample Input
2 2 3 1
Sample Output
7 3 0 8 5 1
Comments