- Time limit: 1.00 s
- Memory limit: 512 MB
Fibonacci sequence is defined as
with seed numbers
and
.
Teemu wonders how the Fibonacci sequence behaves if he changes the seed numbers to something else. Help Teemu to investigate this matter by providing him a program for computing . As this number may grow quickly, your program should only output result modulo .
Input
The first line of input consists of three numbers , and , the seed numbers and the index in Fibonacci sequence.
Output
Output a single line containing modulo .
Limit
Example
Input:
1 3 7
Output:
29
The sequence starts .