import std.stdio; import std.string; import std.array; import std.typecons; import std.typetuple; import std.container; import std.algorithm; import std.conv; import std.math; import std.format; alias TypeTuple tie; void readlnToken(T...)(auto ref T args) { import std.stdio; import std.conv; import std.string; import std.array; auto line = split(readln().strip); foreach(ref arg; args) { arg = to!(typeof(arg))(line[0]); line = line[1..$]; } assert(line.empty()); // got all token?? } const Mod = cast(long)(1E+9)+7; void solve() { int N,S,K; readlnToken(N,S,K); S -= N*(N-1)/2 * K; if (S < 0) { writeln(0); return; } auto dp = new long[][](N+1,S+1); dp[0][0] = 1; foreach(i;1..N+1) { foreach(j;0..S+1) { dp[i][j] = dp[i-1][j] % Mod; int k = j - (N-i+1); if (k >= 0) (dp[i][j] += dp[i][k] % Mod) %= Mod; } } writeln(dp[N][S]); } void main() { solve(); }