
After ten years of programming, Vinko has decided to change his profession and become a ceramist. Already on the first day of his new job he got an extremely difficult task.
He has to pave the concert hall's floor with square ceramic tiles. However, he won't pave the floor so that the tiles are parallel with the hall's walls. Instead, he will rotate them so that the diagonals of the tiles are parallel to the walls.
Vinko has not decided which size of tiles he will use, but he knows they all have to
be the same size, and that the length of their diagonals in millimeters has to be a positive even integer.
He will put the first tile so that it touches the bottom and left walls, and then he will pave the others so
that they share a side with some of the previously set tiles. He will repeat the procedure until he paves
the whole floor, whose dimensions are
Besides being a good programmer and ceramist, Vinko is also an excellent musician. Because of that,
he knows that there are
The right image shows the paving whose tiles have a diagonal of length
Help Vinko determine for each of the
Input Specification
The first line contains the integer
The following
Output Specification
In the
Constraints
Subtask | Points | Constraints |
---|---|---|
No additional constraints. |
Sample Input 1
3
1 4
0 0
0 9
Sample Output 1
1
0
3
Sample Input 2
3
5 1
4 3
2 4
Sample Output 2
0
1
1
Explanation for Sample Output 2
Images from the task statement correspond to the second example.
Comments