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 square millimeters.

Besides being a good programmer and ceramist, Vinko is also an excellent musician. Because of that, he knows that there are points on the floor that are crucial for good acoustics in the hall. The hall's acoustics would improve significantly if a tile's corner is at one of the points.

*The left image shows the paving whose tiles have a diagonal of length . The point is on the corner of a tile, and for it the acoustics are good, but for the points and they are not.*

*The right image shows the paving whose tiles have a diagonal of length . The point is at the corner of a tile, while points and are not.*

Help Vinko determine for each of the points in how many ways can he pave the floor (that is, how many different dimensions of the tiles can he choose) so that the -th point is at a tile corner.

#### Input Specification

The first line contains the integer , the number of acoustic points.

The following lines contain two integers , which indicates that the -th point is millimeters away from the left wall, and millimeters away from the lower wall of the hall.

#### Output Specification

In the -th of lines print the number from the task statement for the -th point.

#### 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