#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef uint64_t u64; typedef int64_t s64; typedef uint32_t u32; typedef int32_t s32; typedef vector vs32; typedef vector vu32; typedef vector vs64; typedef vector vu64; const double PI=3.14159265358979323846; #define MAX(x, y) ((x) < (y) ? (y) : (x)) #define MIN(x, y) ((x) > (y) ? (y) : (x)) #define rep(i, N) for(int i = 0; i < N; ++i) #define CEIL(x, y) (((x) + (y) - 1) / (y)) #define MOD 1000000007ULL #define IN(l, r, x) ((l) <= (x) && (x) < (r)) int main() { cin.tie(0); ios::sync_with_stdio(false); int n, s, k; cin >> n >> s >> k; if (s < n * (n - 1) * k / 2) { cout << "0\n"; return 0; } int m = s - n * (n - 1) * k / 2; cout << "m = " << m << "\n"; s64 dp[n + 1][m + 1]; rep (i, n + 1) rep (j, m + 1) dp[i][j] = 0; dp[0][0] = 1; for (int i = 1; i <= n; ++i) { rep (j, m + 1) { if (j - i >= 0) dp[i][j] = (dp[i][j - i] + dp[i - 1][j]) % MOD; else dp[i][j] = dp[i - 1][j]; } } cout << dp[n][m] << "\n"; return 0; }