#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
const ll MOD=998244353;
ll dp[3001][3001];

int main(){
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  dp[a][b]=1;
  for(ll i=a;i<=c;i++)for(ll j=b;j<=d;j++)if(a!=i || b!=j)dp[i][j]=(i*dp[i][j-1]+j*dp[i-1][j]-(i-1)*(j-1)*dp[i-1][j-1]%MOD+MOD)%MOD;
  cout<<dp[c][d]<<endl;
}
