#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 3005
#define inf 1e9
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
using namespace std;

ll dp[maxn][maxn],a,b,c,d;
const ll mod=998244353;

int main()
{
	cin>>a>>b>>c>>d; dp[a][b]=1;
	for(ll i=a;i<=c;i++)
	{
		for(ll j=b;j<=d;j++)
		{
			if(i==a&&j==b) continue;
			ll tmp=((i-1)*(j-1)*(dp[i-1][j-1]))%mod;
			dp[i][j]=((dp[i-1][j]*j)%mod+(i*dp[i][j-1])%mod-tmp+mod)%mod;
		}
	}
	cout<<dp[c][d]<<endl;
	return 0;
}