You are located on the point of an infinite integer grid, and you need to go to . You have two follow two conditions when moving:
At every step, you can only go to any of the eight points horizontally, vertically or diagonally adjacent to the point where you currently are.
Every movement must strictly reduce the geometric distance to .
In how many ways can you reach ?
Input consists of several cases with two integers and , each between and . A case with ends the input.
For every case, print the number of ways to go from to . Since this number can be huge, compute it modulo .
Input
0 1 -1 -1 0 -2 -5 3 2000 2000 0 0
Output
1 3 7 9132 6647843