#include #define rep(i,n) for(int i=0; i= mod) x -= mod; return *this; } mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; } mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { mint res(*this); return res+=a; } mint operator-(const mint a) const { mint res(*this); return res-=a; } mint operator*(const mint a) const { mint res(*this); return res*=a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod-2); } mint& operator/=(const mint a) { return (*this) *= a.inv(); } mint operator/(const mint a) const { mint res(*this); return res/=a; } }; // 出力は.xで!!!! int main(){ int n,d,k; cin >> n >> d >> k; mint dp[n+1][k+1]; mint rui[k+1]; rep(i,k+1) dp[0][i]=0; dp[0][0]=1; for(int i=1; i<=n; i++){ rui[0]=dp[i-1][0]; rep(p,k) rui[p+1]=rui[p]+dp[i-1][p+1]; for(int j=i; j<=min(k,(i+1)*d); j++){ if(j-d-1<0) dp[i][j]=rui[j-1]; else dp[i][j]=rui[j-1]-rui[j-d-1]; } } cout << dp[n][k].x << endl; return 0; }