#include <bits/stdc++.h>
#define Int int64_t

using namespace std;

int main() {
	constexpr Int MOD = 998244353;
	Int A, B, C, D;
	cin >> A >> B >> C >> D;

	vector<vector<Int>> dp(C + 10, vector<Int>(D + 10, 0));
	dp[A][B] = 1;
	for (Int a = A; a <= C; ++a) {
		for (Int b = B; b <= D; ++b) {
			(dp[a + 1][b] += b * dp[a][b]) %= MOD;
			(dp[a][b + 1] += a * dp[a][b]) %= MOD;
			
			Int X = dp[a][b] * a % MOD * b % MOD;
			(dp[a + 1][b + 1] += MOD - X) %= MOD;
		}
	}
	cout << dp[C][D] % MOD << endl;

	return 0;
}
