AMAZMOSQ
The mosquitoes of the Amazon are less famous than those of the West Nile. Perhaps because they only live for one day. However, they multiply very quickly. We start with mosquitoes on day . During a day, each mosquito bites one person. Then, it gives birth to new mosquitoes and immediately dies.
Find out how many bites the human race will have received in total, at the end of the -th day.
The number of bites will be very large, so you are asked to find the remainder of its division by .
Input
The input will consist of a single line containing three natural numbers, , , , separated in pairs by a single space.
Output
The output should consist of a single line containing one natural number: the remainder of the division of the total number of bites by .
Constraints
Execution time limit: 1 sec.
Memory limit: 64 MB.
Examples of Input - Output
1st
STDIN (amazmosq.in)
1 2 12
STDOUT (amazmosq.out)
8191
2nd
STDIN (amazmosq.in)
3 42 5
STDOUT (amazmosq.out)
18968698
Explanation of the Examples: The evolution of mosquitoes and bites for the two examples:
Comments