#include using namespace std; template class mod_int { using ll = long long; public: constexpr mod_int() : n(0) {} constexpr mod_int(int n_) : n(n_) { if(n >= Mod) n %= Mod; else if(n < 0) n = (n % Mod + Mod) % Mod; } constexpr mod_int(ll n_) : n(n_) { n = (n + Mod) % Mod; } constexpr operator int() const { return n; } constexpr operator ll() const { return n; } constexpr bool operator==(mod_int const& other) const { return n == other.n; } constexpr mod_int& operator+=(mod_int const& other) { if((n += other.n) >= Mod) n -= Mod; return *this; } constexpr mod_int& operator-=(mod_int const& other) { if((n += Mod - other.n) >= Mod) n -= Mod; return *this; } constexpr mod_int& operator*=(mod_int const& other) { n = (unsigned long long)n * other.n % Mod; return *this; } constexpr typename std::enable_if::type& operator/=(mod_int const& other) { return *this *= other.inverse(); } constexpr mod_int operator+(mod_int other) const { return mod_int(*this) += other; } constexpr mod_int operator-(mod_int other) const { return mod_int(*this) -= other; } constexpr mod_int operator*(mod_int other) const { return mod_int(*this) *= other; } constexpr mod_int operator/(mod_int other) const { return mod_int(*this) /= other; } constexpr typename std::enable_if::type inverse() const { ll a = n, b = Mod, u = 1, v = 0; while(b) { ll t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } return mod_int(u); } private: ll n; }; template std::ostream& operator<<(std::ostream& os, mod_int const& n) { os << (int)n; return os; } constexpr int default_mod = 1000000007; template mod_int fact(int n) { static std::vector> v = {1}; if(n >= static_cast(v.size())) { const int from = v.size(), to = n + 1024; v.reserve(to); for(int i = from; i < to; ++i) { v.push_back(v.back() * mod_int(i)); } } return v[n]; } template mod_int comb(int n, int r) { // nCr if(r < 0 || r > n) return 0; return fact(n) / fact(r) / fact(n - r); } using ll = long long; using mint = mod_int; // default int main() { ll n, m, d1, d2; cin >> n >> m >> d1 >> d2; const ll w = m - d1 * (n - 1) - 1; mint ans; for(int i = 0; i < n; ++i) { const ll t = w - (d2 - d1 + 1) * i; if(t < 0) continue; if(i & 1) { ans -= comb(n - 1, i) * comb(t + n, n); } else { ans += comb(n - 1, i) * comb(t + n, n); } } cout << ans << endl; }