#include #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define REP(i,b) FOR(i,0,b) using namespace std; typedef long long LL; LL DP[101][20001]; LL sum[22001]; const LL p=7+1e+9; int main() { LL N,S,K; cin >> N >> S >> K; DP[0][0]=1; LL c=0; FOR(i,1,N+1){ LL suv=(N-i+1); REP(j,S+1) sum[j]=DP[i-1][j]; REP(j,S+1) sum[j+suv]+=sum[j]; FOR(j,c*suv,S+1) DP[i][j]=sum[j-c*suv]; REP(j,S+1) DP[i][j]%=p; c=K; } cout << DP[N][S] << endl; // your code goes here return 0; }