#include<bits/stdc++.h>

using namespace std;

const long long mo = 998244353;

long long dp[3010][3010];
int a, b, c, d;
int main()
{
   cin>>a>>b>>c>>d;

   c-=a;
   d-=b;

   dp[0][0] = 1;

   for (int i = 0;i<=c;i++)
    for (int j = 0;j<=d;j++)
    if (i+j)
   {
       if (i) dp[i][j]+=dp[i-1][j]*(j + b);
       if (j) dp[i][j]+=dp[i][j-1]*(i + a);
       if (i && j)
       dp[i][j]-=dp[i-1][j-1] * (j - 1 + b) * ( i - 1 + a);
       dp[i][j]%=mo;
       if (dp[i][j] < 0) dp[i][j]+=mo;
   }

   cout<<dp[c][d];
}
