#include using namespace std; #define int long long #ifdef LOCAL_DEBUG #include "LOCAL_DEBUG.hpp" #endif const int MOD = 1e9+7; int PartNum(int n,int m,int k){ //n = m以下の自然数の和 k個で構成される分割数 vector> dp(n+1,vector (m+1,0)); //iをj以下の自然数の和に分ける場合の数 dp[0][0] = 1; for(int i = 0; i <= n; i++){ for(int j = 1; j <= m; j++){ if(i-j >= 0){ dp[i][j] = dp[i-j][j] + dp[i][j-1]; } else { dp[i][j] = dp[i][i]; } if(i-j-k >= 0){ dp[i][j] += MOD - dp[i-j-k][j-1]; } dp[i][j] %= MOD; } } return dp[n][m]; } signed main(){ int n,s,k; cin >> n >> s >> k; s -= (n-1)*k*n/2; if(s < 0){ cout << 0 << endl; return 0; } cout << PartNum(s,n,1<<30) << endl; return 0; }