You have identical 3-3 domino pieces, and you must cover with them a rectangle. As you can see in the picture below, the positions of the rectangle must be left empty. Depending on , how many different rectangles are possible?
For instance, these are the two only possible rectangles for , two of the six possible rectangles for , and a possible rectangle for :
Input consists of several cases, each with two integer numbers and . You can assume and .
For every case, print the number of rectangles modulo .
Input
0 1000 1 1000 2 1000 2 4 7 127 1000000000000 998877
Output
1 2 6 2 61 751275