Have an infinite collection of pieces , and , and you must completely fill a rectangle. In how many ways can you do it?
For example, this is one of the many ways for :
(9,4)
(1,1)(1,0)7 (1,1)(0,1)2 (8,3)(-1,0)7 (8,3)(0,-1)2
(2,1)(0,1)2 (2,2)(1,0)1 (3,1)(0,1)1 (3,2)(1,0)1 (4,2)(0,1)1 (4,2)(1,0)1 (5,1)(0,1)2 (7,1)(0,1)2 (7,2)(1,0)1
Input consists of several cases, each with an between 1 and .
For every case, print the number of ways to fill a rectangle. Since this number can be very large, make the computations modulo .
It may be helpful to compute a quantity similar to the one asked for in the problem.
Input
1 2 3 4 10000
Output
2 8 26 90 52273134