Please compute the number of different sequences of length , made up of only zeroes and ones, and with no more than two consecutive ones.
Input consists of several cases, each with a natural number between 0 and .
For every case, print the number of different sequences of bits that do not have more than two consecutive ones, modulo .
A matrix can be powered to a natural number with only products of matrices.
Input
0 1 2 3 4 5 20 1000 123456789
Output
1 2 4 7 13 24 223317 475857792 357891500