#include<iostream>
#define mod 998244353

using namespace std;

long long dp[3005][3005];

int main(){
    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){
            if(i!=a||j!=b){
                dp[i][j]=dp[i-1][j]*j%mod;
                dp[i][j]+=(dp[i][j-1]*i)%mod;
                dp[i][j]-=(dp[i-1][j-1])*(i-1)*(j-1)%mod;
              	dp[i][j]=(dp[i][j]+mod)%mod;
            }
        }
    }
    cout<<dp[c][d]<<endl;
    return 0;
}