// M
#include<bits/stdc++.h>
using namespace std;
const int N = 3003, Mod = 998244353;
int n, m, a, b, dp[N][N][2];
int main()
{
	scanf("%d%d%d%d", &a, &b, &n, &m);
	dp[a][b][0] = 1;
	for (int i = a; i <= n; i ++)
		for (int j = b; j <= m; j ++)
			if (i > a || j > b)
			{
				// dp[i][j][0] : i * j and we cannot take the last row
				dp[i][j][0] = (dp[i][j - 1][1] + dp[i][j - 1][0] * 1LL * i) % Mod;
				dp[i][j][1] = (dp[i - 1][j][0] + dp[i - 1][j][1]) * 1LL * j % Mod;
			}
	return !printf("%d\n", (dp[n][m][0] + dp[n][m][1]) % Mod);
}
