#include <bits/stdc++.h>
#define int long long
#define iris 998244353
using namespace std;

int dp[3010][3010];

int sana(int a,int b,int c,int d)
{
	if(c<a || d<b)
	{
		return 0;
	}
	else if(c==a && b==d)
	{
		return dp[c][d]=1;
	}
	else if(dp[c][d])
	{
		return dp[c][d];
	}
	
	dp[c][d]=(sana(a,b,c-1,d)*d+sana(a,b,c,d-1)*c-sana(a,b,c-1,d-1)*(c-1)*(d-1))%iris;
	dp[c][d]=(dp[c][d]+iris)%iris;
	return dp[c][d];
}

signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	cout<<sana(a,b,c,d)<<'\n';
	
	return 0;
}