#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

ll A, B, C, D;
vector<vector<vector<ll>>> Dp;
const ll MOD = 998244353;

int main() {
	cin >> A >> B >> C >> D;
	vector<vector<long long>> DP(C + 1, vector<long long >(D + 1));
	DP[A][B] = 1;
	for (int n = A; n <= C; ++n) {
		for (int m = B; m <= D; ++m) {
			if (n == A && m == B) {
				continue;
			}
			DP[n][m] = (m *DP[n - 1][m]  + n * DP[n][m - 1]  - (n - 1) *(m - 1) *DP[n - 1][m - 1] % MOD+ MOD) % MOD;
			//負のあまりは調整が必要！
		}
	}
	cout << DP[C][D] << endl;
	return 0;
}