#include #define REP(i, x, y) for (ll i = x; i <= y; i++) #define BIT(t) (1ll << t) #define PER(i, y, x) for (ll i = y; i >= x; i--) #define vll vector #define vvll vector> #define pll pair #define SIZE(v) ll(v.size()) #define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end()); using namespace std; typedef long long ll; // ios::sync_with_stdio(false); // cin.tie(nullptr); ll const MOD = 1e9 + 7; ll mod_p(ll x, ll y) { x %= MOD; y %= MOD; return (x + y + MOD) % MOD; } ll mod_m(ll x, ll y) { x %= MOD; y %= MOD; return x * y%MOD; } ll mod_pow(ll x, ll t) { x %= MOD; if (t == 0) { return 1; } else { ll v = mod_pow(x, t / 2); if (t % 2 == 0) { return v * v % MOD; } else { return v * v%MOD * x %MOD; } } } ll mod_inv(ll x) { return mod_pow(x, MOD - 2); } vll fct(2e6+1), invfct(2e6+1); void init(){ fct[0] = invfct[0] = 1; REP(i,1,2e6){ fct[i] = mod_m(fct[i-1] , i); invfct[i] = mod_inv(fct[i]); } } ll ncr(ll n, ll r){ return mod_m(fct[n], mod_m(invfct[r], invfct[n-r])); } int main(){ init(); ll n,m,d1, d2; cin >> n >> m >> d1 >> d2; ll d = d2 - d1; ll l = m - 1 - d1*(n-1); if(l < 0){ cout << 0 << endl; return 0; } vll a(m+2), sm(m+2,0); REP(i,0,m){ a[i] = ncr(n+i-1, i); } sm[0] = a[0]; REP(i,1,m){ sm[i] = mod_p(sm[i-1],a[i]); } ll ans = 0; REP(i,0,n-1){ ll tmp = ncr(n-1, i); if(i % 2 == 1){ tmp = mod_m(tmp, -1); } ll v = l - i * (d + 1); if(v < 0) break; ans = mod_p(ans, mod_m(sm[v], tmp)); // cout << v << " " << mod_m(sm[v], tmp) << endl; } cout << ans << endl; }