#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3010, mod = 998244353;
int a, b, c, d, f[N][N];
signed main() {
    scanf ("%d %d %d %d", &a, &b, &c, &d);
    f[a][b] = 1;
    for (int i = a; i <= c; ++i)
        for (int j = b; j <= d; ++j) {
            if (i == a && j == b) continue;
            f[i][j] = f[i - 1][j] * j + f[i][j - 1] * i - f[i - 1][j - 1] * (i - 1) * (j - 1);
            f[i][j] = (f[i][j] % mod + mod) % mod;
        }
    return printf ("%lld\n", f[c][d]), 0;
}
