#define _CRT_SECURE_NO_WARNINGS
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <fstream>
#include <array>
#include <map>
#include <queue>
#include <time.h>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <assert.h>
#include <bitset>
#include <unordered_set>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) (min(a,b) <= (x) && (x) <= max(a,b)) //hei
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 998244353LL 
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
 
 
#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
	std::fill((T*)array, (T*)(array + N), val);
}
 
//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL

 
struct Edge {
	int from, to;
	ll w;
	bool operator<(const Edge& rhs) const {
		return MP(w, MP(from, to)) < MP(rhs.w, MP(rhs.from, rhs.to));
	}
 
};
typedef vector<vector<Edge>> Graph;
typedef unsigned long long ull;
 
 
inline ll ksum(ll n, ll k){
  return k * (2*n - k - 1);
}

pii updtp2(pii p, int nw){
  if(p.first == -1) p.first = nw;
  else if(p.second == -1) p.second = nw;
  else if(p.first >= nw) {
    p.second = p.first;
    p.first = nw;
  }
  else if(p.second >= nw) p.second = nw;
  return p;
}
 
#define isValid(y,x) (y >=0 && y < n && x >= 0 && x < m)

const pii Dir[4] = {{-1,0}, {0,1}, {1,0}, {0,-1}};

ll mod_pow(ll x, ll n, ll mod) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = (res * x) %mod;
		x = (x*x)%mod;
		n >>= 1;
	}
	return res;
}


ll dp[3001][3001] = {};
ll on[3001][3001][2] = {};
int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;

    REP(i,a + 1){
        REP(j,b + 1){
            dp[i][j] = 1;
        }
    }

    rep(i, a, c + 1) {
        rep(j, b, d + 1) {
            if(i <= a && j <= b) continue;
            if(i > a && j > b){
              dp[i][j] = (dp[i-1][j]*j + dp[i][j-1]*i - on[i][j-1][0]*(i-1))%MODU;
              on[i][j][0] = (dp[i-1][j] * j) % MODU;
            }
            else if(i > a){
              dp[i][j] = (dp[i-1][j] * j) %MODU;
              on[i][j][0] = (dp[i-1][j] * j) % MODU;
            }
            else if(j > b){
              dp[i][j] = (dp[i][j-1] * i) %MODU;
              on[i][j][0] = (on[i][j-1][0] * (i-1) + mod_pow(i-1, j-1, MODU))%MODU;
            }
          //	printf("%d,%d:%d\n",i,j,dp[i][j]);
        }
    }

    cout << (MODU+dp[c][d])%MODU << endl;

	return 0;
} 

Measured memory_bytes: 214520