No.673 Beetles
タグ : / 解いたユーザー数 142
作問者 :
nmnmnmnmnmnmnm
/ テスター :
tanzaku
Problem Statement
Every year, without fail, A-kun buys B beetles on January 1st.
When he counts them on New Year's Eve, December 31st, the number has grown to C times the number present on January 1st.
If he buys B beetles on January 1st of year 1, there are B $\times$C beetles on New Year's Eve.
On January 1st of year 2 there are B $\times$C+B beetles, and on New Year's Eve there are (B $\times$C+B) $\times$C beetles.
How many beetles are there on New Year's Eve of year D?
However, output the answer modulo 1000000007.
Input
B C D
B, C, and D are all positive integers.
$1 \le$ B,C,D $\le 1000000000000=10^{12}$.
Output
Output on one line the number of beetles on New Year's Eve of year D, modulo 1000000007.
Print a newline at the end.
Sample
Sample 1
Input
1 2 3
Output
14
In year 1, he buys 1 beetle on January 1st, and on New Year's Eve it has doubled to 2 beetles.
In year 2, he buys 1 beetle on January 1st, for a total of 3 beetles. On New Year's Eve this has doubled to 6 beetles.
In year 3, he buys 1 beetle on January 1st, for a total of 7 beetles. On New Year's Eve this has doubled to 14 beetles.
Sample 2
Input
100 1 100
Output
10000
He buys 100 more beetles each year for 100 years, so there are 10000 beetles.
Sample 3
Input
123 456 789
Output
198020583
Sample 4
Input
1000000000000 1000000000000 1000000000000
Output
214111862
This is the maximum case.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。