#include <bits/stdc++.h>
using namespace std;

long long dp[3010][3010];
constexpr int mod = 998244353;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int A, B, C, D; cin >> A >> B >> C >> D;
    dp[A][B] = 1;
    for (int i = A; i <= C; i++) {
        for (int j = B; j <= D; j++) {
            dp[i][j] %= mod;
            dp[i+1][j] += dp[i][j] * j % mod;
            dp[i][j+1] += dp[i][j] * i % mod;
            dp[i+1][j+1] += mod - dp[i][j] * i % mod * j % mod;
        }
    }
    cout << dp[C][D] % mod << "\n";
    return 0;
}