Inaho has stumbled across a sequence of integers . He knows the values of the first
terms
to
. He also knows that how to compute the rest of the sequence: it satisfies the following recursive formula:
for all integers
and he already has the values of
. With this information, can you help him calculate
? Since this number may be large, please output it modulo
.
Constraints
for all
.
In of the cases,
.
In an additional of the cases,
.
In an additional of the cases,
.
Input Specification
The first line will contain two space-separated integers and
.
The next line will contain space-separated integers
.
The final line will contain space-separated integers
.
Output Specification
Output a single integer, .
Sample Input
2 10
1 1
1 1
Sample Output
89
Comments