#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int MAXN = 3005;
const ll MOD = 998244353;

int A,B,C,D;

ll f[MAXN][MAXN];

int main()
{
	cin >> A >> B >> C >> D;
	for (int i = A;i <= C;i++)
		for (int j = B;j <= D;j++)
		{
			if (i == A && j == B)
			{
				f[i][j] = 1;
				continue;
			}
			if (i == A)
				f[i][j] = f[i][j - 1] * i % MOD;
			if (j == B)
				f[i][j] = f[i - 1][j] * j % MOD;
			if (i != A && j != B)
				f[i][j] = (f[i][j - 1] * i + f[i - 1][j] * j - f[i - 1][j - 1] * (i - 1) % MOD * (j - 1)) % MOD;
		}
	cout << (f[C][D] + MOD) % MOD << endl;
	return 0;
}