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

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int A, B, C, D;
  cin >> A >> B >> C >> D;
  const int MOD = 998244353;
  vector<vector<int>> dp(C + 2, vector<int>(D + 2, 0));
  dp[C][D] = 1;
  for (int i = C; i >= A; i--) {
    for (int j = D; j >= B; j--) {
      dp[i][j - 1] += 1ll * i * dp[i][j] % MOD;
      dp[i][j - 1] %= MOD;
      dp[i - 1][j] += 1ll * j * dp[i][j] % MOD;
      dp[i - 1][j] %= MOD;
      dp[i - 1][j - 1] -= 1ll * (i - 1) * (j - 1) * dp[i][j] % MOD;
    }
  }
  cout << (dp[A][B] + MOD) % MOD << "\n";
  return 0;
}
