Power of Power Partition Function

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Let mm be a fixed integer such that m2m \ge 2. For a positive integer nn, let b_m(n)b\_{m}(n) denote the number of ways of writing nn as a sum of powers of mm using non-negative exponents with repetitions allowed and the order of the summands not being taken into account. We also set b_m(0)=1b\_{m}(0) = 1 (there is one empty sum).

For example, the first 1010 terms of b_2(n)\\{b\_{2}(n)\\} are 1,1,2,2,4,4,6,6,10,10\\{1, 1, 2, 2, 4, 4, 6, 6, 10, 10\\}, and the first 1010 terms of b_3(n)\\{b\_{3}(n)\\} are 1,1,1,2,2,2,3,3,3,5\\{1, 1, 1, 2, 2, 2, 3, 3, 3, 5\\}.

Let c_mk(n)c\_{m}^{k}(n) be the kk-th convolution power of b_m(n)b\_{m}(n), which is defined as follows: c_mk(n)={b_m(n),k=1 _i=0nb_m(i)c_mk1(ni),k2c\_{m}^{k}(n)=\begin{cases} b\_{m}(n), & k = 1 \\\ \sum\limits\_{i=0}^{n} b\_{m}(i) \cdot c\_{m}^{k-1}(n-i), & k \ge 2 \end{cases}

Given nn, mm and kk, Bobo would like to find the value of f(n)=(_i=0nck_m(i))mod(109+7).f(n) = \left( \sum\limits\_{i=0}^{n}c^{k}\_{m}(i) \right) \bmod (10^9 + 7)\text{.}

입력

The first line contains three integers nn, mm and kk (0n10180 \leq n \leq 10^{18}, 2m10182 \leq m \leq 10^{18}, 1k101 \leq k \leq 10).

출력

Output an integer denoting the value of f(n)f(n).