#include <bits/stdc++.h>
#define meow(args...) fprintf(stderr, args)
typedef unsigned u32;
const u32 P=998244353;
u32 f[3001][3001], g[3001][3001];
int main() {
	int a, b, c, d;
	scanf("%d%d%d%d", &a, &b, &c, &d);
	g[a][b]=1;
	for(int i=a; i<=c; ++i) {
		for(int j=b; j<=d; ++j) {
			if(j>b) f[i][j]=(1llu*i*(f[i][j-1]+g[i][j-1]))%P;
			if(i>a) g[i][j]=(1llu*j*g[i-1][j]+f[i-1][j])%P;
		}
	}
	printf("%u\n", (f[c][d]+g[c][d])%P);
	return 0;
}