#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define int ll
typedef long double ld;

typedef pair<int,int> pii;
#define x first
#define y second

const int N=3010,MOD=998244353;

int dp[N][N];

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    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]=(dp[i][j]+
                      dp[i-1][j]*j+
                      dp[i][j-1]*i-
                      dp[i-1][j-1]*(i-1)*(j-1))%MOD;
    cout<<(dp[c][d]+MOD)%MOD;
}
