#include using namespace std; using ll = long long; templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b> dp; //dp[M][N] ll N = -1; ll M = -1; void init(ll n, ll m){ N = n; M = m; // 大きめに確保 dp.resize(M+5); REP(i, M+5){ dp[i].resize(N+5, 0); } prepare(); } void prepare(){ dp[0][0] = 1; FOR(i, 1, M+1){ FOR(j, 0, N+1){ if(j-i>=0){ dp[i][j] = (dp[i-1][j] + dp[i][j-i]) % mod; }else{ dp[i][j] = dp[i-1][j]; } } } } ll f(ll n, ll m){ return dp[m][n]; } }; int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll N, S, K; cin >> N >> S >> K; // K円を先に徴収する FOR(i, 0, N){ S -= K*i; } if(S<0){ p(0); return 0; } // 残りを分割数で分けて、昇順に割り振るとする auto partition = PartitionFunction(); partition.init(20000, 100); ll ans = partition.f(S, N); p(ans); return 0; }