#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
long long dp[3001][3001];
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  for(int i=A;i<=C;i++){
    for(int j=B;j<=D;j++){
      if(i==A&&j==B) dp[A][B]=1;
      else if(i==A&&j!=B) dp[A][j]=(A*dp[A][j-1])%998244353;
      else if(i!=A&&j==B) dp[i][B]=(B*dp[i-1][B])%998244353;
      else{
       dp[i][j]=(i*dp[i][j-1]+j*dp[i-1][j]-((i-1)*(j-1)*(dp[i-1][j-1]%998244353))%998244353);
       if(dp[i][j]<0) dp[i][j]+=998244353;
       dp[i][j]=dp[i][j]%998244353;
      }
    }
  }
  cout<<dp[C][D]<<endl;
  
  return 0;
}