import java.util.ArrayDeque; import java.util.Arrays; import java.util.Scanner; class Main { public static void main(String[] args) { new Main().run(); } final long mo = 1_000_000_000 + 7; void run() { long[] fac = new long[2_000_000]; long[] invfac = new long[fac.length]; long[] inv = new long[fac.length]; fac[0] = 1; inv[0] = 1; inv[1] = 1; invfac[0] = 1; for (int i = 1; i < fac.length; ++i) { fac[i] = fac[i - 1] * i % mo; } for (int i = 2; i < inv.length; ++i) { // 0=p/i*i+p%i // i^(-1)=-1*(p/i)*(p%i)^(-1) inv[i] = (mo - inv[(int) (mo % i)] * (mo / i) % mo) % mo; } for (int i = 1; i < invfac.length; ++i) { invfac[i] = invfac[i - 1] * inv[i] % mo; } Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int K = sc.nextInt(); int D = sc.nextInt(); int q = N / (K - 1); if (N % (K - 1) == 0) --q; int res = N - q * (K - 1); if (D == 1) { System.out.println(res); return; } long comb = 0; long pow = 1; for (int i = 0; i <= q; ++i) { comb = comb + pow * H(q - i, res - 1, fac, invfac, mo); comb %= mo; pow = (pow * D) % mo; } comb = (comb * res) % mo; System.out.println(comb); } long H(int a, int b, long[] fac, long[] invfac, long mo) { // (a+b-1)C(a) return fac[a + b - 1] * invfac[a] % mo * invfac[b - 1] % mo; } void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }