#include #include using namespace atcoder; using namespace std; using mint = modint1000000007; using ll = long long; const int MAX = 11000000; const int MOD = 1000000007; long long fac[MAX], finv[MAX], inv[MAX]; void COMinit(){ fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; inv[1] = 1; for(int i = 2; i < MAX; i++){ fac[i] = fac[i-1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD/i) % MOD; finv[i] = finv[i-1] * inv[i] % MOD; } } long long COM(long long n, long long k){ if(n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD; } int main() { ll N, M, D1, D2;cin >> N >> M >> D1 >> D2; ll D = D2 - D1; ll x =M - (D1 * (N -1)) - 1; if (x < 0) { cout << 0 << endl;return 0; } COMinit(); mint ans = 0; for (ll p = 0;p < N;p++) { mint tmp = mint(COM(x + N - (p * (D + 1)), N)) * mint(COM(N - 1, p)); ans += (p % 2 == 0 ? 1 : -1) * tmp; } cout << ans.val() << endl; }