#include<bits/stdc++.h>
using namespace std;

typedef long long LL;

const int N = 3005;
const int MOD = 998244353;

int A, B, C, D, f[N][N][2];

int main()
{
	scanf("%d%d%d%d", &A, &B, &C, &D);
	f[A][B][1] = 1;
	for (int i = A; i <= C; i++)
		for (int j = B; j <= D; j++) if (i > A || j > B)
		{
			f[i][j][0] = (LL)(f[i - 1][j][0] + f[i - 1][j][1]) * j % MOD;
			f[i][j][1] = (f[i][j - 1][0] + (LL)f[i][j - 1][1] * i % MOD) % MOD;
		}
	printf("%d\n", (f[C][D][0] + f[C][D][1]) % MOD);
	return 0;
}