#include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair i_i; struct edge { int i, v, z; }; int MOD = 1000000007; int main() { int N, S, K; cin >> N >> S >> K; vector > dp(N + 1, vector(S + 1)); dp[N][0] = 1; for (int i = N; i > 0; i--) for (int j = 0; j <= S; j++) { if (j + i <= S) dp[i][j + i] = (dp[i][j + i] + dp[i][j]) % MOD; if (j + (i - 1) * K <= S) dp[i - 1][j + (i - 1) * K] = (dp[i - 1][j + (i - 1) * K] + dp[i][j]) % MOD; } cout << dp[0][S] << endl; }