#include<iostream>
#define mod 998244353
using namespace std;
int a, b, c, d, i, j;
int dp[3005][3005], e[3005][3005];
int main(){
    cin>> a >> b >> c >> d;
    dp[c][d] = 1;
    for(i = c; i > a; i--){
        for(j = d; j > b; j--){
            e[i][j] = (dp[i][j] + e[i][j + 1] * 1LL * i) % mod;
        }
        for(j = d; j >= b; j--){
            dp[i][j] = (dp[i][j] + e[i][j + 1]) % mod;
            dp[i - 1][j] = (dp[i - 1][j] + dp[i][j] * 1LL * j) % mod;
        }
    }
    for(j = d; j > b; j--){
        dp[a][j - 1] = (dp[a][j - 1] + dp[a][j] * 1LL * a) % mod;
    }
    cout<< dp[a][b];
}
