#include <bits/stdc++.h>
using namespace std;

using ll=long long;
const ll MOD=998244353;
ll dp[4001][4001],a,b,c,d;
ll f(ll A,ll B){
  if(A<a||B<b)return 0;
  if(~dp[A][B])return dp[A][B];
  return dp[A][B]=(MOD+f(A-1,B)*B+f(A,B-1)*A-f(A-1,B-1)*(A-1)*(B-1)%MOD)%MOD;
}

int main(){
  cin>>a>>b>>c>>d;
  memset(dp,-1,sizeof(dp));
  dp[a][b]=1;
  cout<<f(c,d)<<endl;
}
