#include using namespace std; const long long MOD = 998244353; long long modpow(long long a, long long b){ long long ans = 1; while (b > 0){ if (b % 2 == 1){ ans *= a; ans %= MOD; } a *= a; a %= MOD; b /= 2; } return ans; } long long modinv(long long a){ return modpow(a, MOD - 2); } vector mf = {1}; long long modfact(int n){ if (mf.size() > n){ return mf[n]; } else { for (int i = mf.size(); i <= n; i++){ long long next = mf.back() * i % MOD; mf.push_back(next); } return mf[n]; } } vector ntt(vector A, bool inv){ int N = A.size(); long long r = 3; if (inv){ r = modinv(r); } vector B(N); for (int i = N / 2; i > 0; i /= 2){ long long z = modpow(r, (MOD - 1) / (N / i)); long long z2 = 1; for (int j = 0; j < N; j += i * 2){ for (int k = 0; k < i; k++){ A[i + j + k] *= z2; A[i + j + k] %= MOD; B[j / 2 + k] = (A[j + k] + A[i + j + k]) % MOD; B[N / 2 + j / 2 + k] = (A[j + k] - A[i + j + k] + MOD) % MOD; } z2 = z2 * z % MOD; } swap(A, B); } if (inv){ int Ninv = modinv(N); for (int i = 0; i < N; i++){ A[i] = A[i] * Ninv % MOD; } } return A; } vector convolution(vector A, vector B, int d = -1){ int deg = A.size() + B.size() - 1; int N = 1; while (N < deg){ N *= 2; } A.resize(N); B.resize(N); A = ntt(A, false); B = ntt(B, false); vector ans(N); for (int i = 0; i < N; i++){ ans[i] = A[i] * B[i] % MOD; } ans = ntt(ans, true); if (d != -1){ deg = d; } ans.resize(deg); return ans; } vector fps_power(vector A, int x){ int deg = A.size(); vector ans(deg, 0); ans[0] = 1; while (x > 0){ if (x % 2 == 1){ ans = convolution(ans, A, deg); } A = convolution(A, A, deg); x /= 2; } return ans; } int main(){ int N, M, A, B; cin >> N >> M >> A >> B; vector f(B + 1, 0); for (int i = A; i <= B; i++){ f[i] = 1; } vector g = fps_power(f, N - 1); long long ans = 0; for (int i = 0; i <= B; i++){ ans += g[i] * (M - i) % MOD; ans %= MOD; } ans *= modfact(N); ans %= MOD; cout << ans << endl; }