#include #include #include #include #include using namespace std; using ll = long long; using pii = pair; using pll = pair; using pil = pair; using pli = pair; using vi = vector; using vvi = vector; using vvvi = vector; using vll = vector; using vvll = vector; using vvvll = vector; using vb = vector; using vvb = vector; using vvvb = vector; template using pqr = priority_queue, greater>; const ll INFL = (ll)1e18; const int INF = (int)1e9; const int MOD = 1000000007; template inline bool chmax(T& M, const T& x) { if (M < x) { M = x; return true; } return false; } // 最大値を更新(更新されたら true を返す) template inline bool chmin(T& m, const T& x) { if (m > x) { m = x; return true; } return false; } // 最小値を更新(更新されたら true を返す) int main() { int N, S, K; cin >> N >> S >> K; vvi DP(S + 1, vi(N + 1, 0)); for (int i = 0; i <= S; i++) DP[i][1] = 1; for (int i = 0; i <= S; i++) { for (int j = 2; j <= N; j++) { if (i - j >= 0) DP[i][j] += DP[i - j][j]; if (i - K * (j - 1) >= 0) DP[i][j] += DP[i - K * (j - 1)][j - 1]; DP[i][j] %= MOD; } } cout << DP[S][N] << endl; return 0; }