cho.sh
Notes
Loading...

Number of NKD Sequences

Time limit

2s

Memory limit

512 MB

Problem

You are given three integers NNN, KKK, and DDD. Count the natural-number sequences A1,A2,…,AKA_1, A_2, \dots, A_KA1​,A2​,…,AK​ of length KKK that satisfy all of the following conditions.

  • A1+A2+⋯+AK=NA_1 + A_2 + \dots + A_K = NA1​+A2​+⋯+AK​=N
  • A1<A2<⋯<AKA_1 < A_2 < \dots < A_KA1​<A2​<⋯<AK​
  • For every 1≤i<K1 \le i < K1≤i<K, Ai+1−Ai≤DA_{i+1} - A_i \le DAi+1​−Ai​≤D
  • A1≤DA_1 \le DA1​≤D

Input

The first line contains three integers NNN, KKK, and DDD, separated by spaces.

Output

Print the number of sequences satisfying the conditions, modulo 109+710^9 + 7109+7.

Constraints

  • 1≤N,K,D≤1051 \le N, K, D \le 10^51≤N,K,D≤105