#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=998244353;
int f[3005][3005];
signed main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	f[a][b]=1;
	for(int i=a;i<=c;++i)
		for(int j=b;j<=d;++j){
			if(i==a&&j==b) continue;
			f[i][j]=(f[i-1][j]*j%mod+f[i][j-1]*i%mod)%mod-f[i-1][j-1]*(i-1)%mod*(j-1)%mod;
			f[i][j]=(f[i][j]+mod)%mod;
		}
	cout<<f[c][d];
	return 0;
}