#include <bits/stdc++.h>
#define MAXN 3007
#define MOD 998244353
using namespace std;
long long dp[MAXN][MAXN];
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(a!=i || b!=j) dp[i][j]=(i*dp[i][j-1]+j*dp[i-1][j]-((i-1LL)*(j-1LL)*dp[i-1][j-1])%MOD+MOD)%MOD;
	cout<<dp[c][d];
}
