#include <bits/stdc++.h>
#define LL long long
using namespace std;
LL f[3005][3005];
const int mod = 998244353;
int main(){
    ios::sync_with_stdio(false);
    int a, b, c, d; cin>>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][j - 1] * i % mod + f[i - 1][j] * j % mod - f[i - 1][j - 1] * (i - 1) % mod * (j - 1) %mod + mod;
            f[i][j] %= mod;
        }
    }
    cout<<f[c][d];
    return 0;
}