#include #include using ll = long long; using ull = unsigned long long; #define rep(i, n) for(int i = 0; i < (int)(n); i++) #define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++) using namespace std; using namespace atcoder; using mint = modint1000000007; const int inf = 1000000007; const ll longinf = 1ll << 60; namespace mod_util { vector fact, invfact, inv; void init(int n = 1 << 20) { fact.resize(n + 1); invfact.resize(n + 1); inv.resize(n + 1); fact[0] = 1; rep(i, n) fact[i + 1] = fact[i] * (i + 1); invfact[n] = fact[n].inv(); rep(i, n) invfact[n - i - 1] = invfact[n - i] * (n - i); rep(i, n) inv[i + 1] = fact[i] * invfact[i + 1]; } mint comb(int n, int k) { if(n < 0 || k < 0 || k > n) return 0; return fact[n] * invfact[k] * invfact[n - k]; } } // namespace mod_util using namespace mod_util; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); init(1 << 21); int n, m, d1, d2; cin >> n >> m >> d1 >> d2; vector bunshi(m + 1), bunbo(m + 1); rep(i, n) { ll p = ll(d1) * i + ll(d2 + 1) * (n - 1 - i); if(p > m) continue; if(i % 2 == 0) { bunshi[p] = comb(n - 1, i); } else { bunshi[p] = -comb(n - 1, i); } } rep(i, m + 1) { bunbo[i] = comb(n + i, i); } mint ans = 0; rep(i, m) { ans += bunshi[i] * bunbo[m - 1 - i]; } cout << ans.val() << endl; return 0; }