#include #include #include using namespace std; const int MOD = 1e9+7; typedef long long ll; int main(){ int n, s, k; cin >> n >> s >> k; ll dp[n+1][s+1]; //dp[i][j]:i人でjを分ける総数 memset(dp, 0, sizeof(dp)); dp[1][0] = 1; for(int i=1; i<=n; i++){ for(int j=0; j<=s; j++){ int rem = n-i+1; if(j >= k*rem ){ dp[i][j] += dp[i-1][j-k*rem]; } if(j >= rem) { dp[i][j] += dp[i][j-rem]; } dp[i][j] %= MOD; } } cout << dp[n][s] << endl; return 0; }