#include <bits/stdc++.h>
#define ll long long 
#define ld long double
using namespace std;
const ll INF = 1e18;
const ll MOD = 998244353;



struct mint {
  ll x;
  mint():x(0){}
  mint(ll x):x((x%MOD+MOD)%MOD){}
  // mint(ll x):x(x){}
  mint& fix() { x = (x%MOD+MOD)%MOD; return *this;}
  mint operator-() const { return mint(0) - *this;}
  mint operator~() const { return mint(1) / *this;}
  mint& operator+=(const mint& a){ if((x+=a.x)>=MOD) x-=MOD; return *this;}
  mint& operator+=(const int& a){ if((x+=a)>=MOD) x-=MOD; return *this;}
  mint& operator+=(const ll& a){ if((x+=a)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const mint& a){ if((x+=MOD-a.x)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const ll& a){ if((x+=MOD-a)>=MOD) x-=MOD; return *this;}
  mint& operator-=(const int& a){ if((x+=MOD-a)>=MOD) x-=MOD; return *this;}
  mint& operator*=(const mint& a){ (x*=a.x)%=MOD; return *this;}
  mint& operator*=(const ll& a){ (x*=a)%=MOD; return *this;}
  mint& operator*=(const int& a){ (x*=a)%=MOD; return *this;}
  mint& operator/=(const mint& a){ (x*=a.ex(MOD-2).x)%=MOD; return *this;}
  mint operator+(const mint& a)const{ return mint(*this) += a;}
  mint operator+(const ll& a)const{ return mint(*this) += mint(a);}
  mint operator+(const int& a)const{ return mint(*this) += mint(a);}
  mint operator-(const mint& a)const{ return mint(*this) -= a;}
  mint operator-(const ll& a)const{ return mint(*this) -= mint(a);}
  mint operator-(const int& a)const{ return mint(*this) -= mint(a);}
  mint operator*(const mint& a)const{ return mint(*this) *= a;}
  mint operator*(const ll& a)const{ return mint(*this) *= mint(a);}
  mint operator*(const int& a)const{ return mint(*this) *= mint(a);}
  mint operator/(const mint& a)const{ return mint(*this) /= a;}
  mint operator/(const ll& a)const{ return mint(*this) /= mint(a);}
  mint operator/(const int& a)const{ return mint(*this) /= mint(a);}
  mint& operator=(const ll&a){ this->x = a; return (*this);}
  mint& operator=(const int&a){ this->x = a; return (*this);}
  mint ex(ll t) const {
    if(!t) return 1;
    mint res = ex(t/2);
    res *= res;
    return (t&1)?res*x:res;
  }
  bool operator<(const mint& a)const{ return x < a.x;}
  bool operator==(const mint& a)const{ return x == a.x;}
  bool operator!=(const mint& a)const{ return x != a.x;}
};

mint ex(mint x, ll t) { return x.ex(t);}
mint operator/(ll a, mint b)    {   return mint(a) / b; }
mint operator*(ll a, mint b)    {   return mint(a) * b; }
mint operator+(ll a, mint b)    {   return mint(a) + b; }
mint operator-(ll a, mint b)    {   return mint(a) - b; }
istream& operator>>(istream&i,mint&a){i>>a.x;return i;}
ostream& operator<<(ostream&o,const mint&a){o<<a.x % MOD;return o;}

mint dp[3010][3010];

int32_t main() {
	ios::sync_with_stdio(!cin.tie(NULL));

	int a, b, c, d;
	cin >> a >> b >> c >> d;

	for(int i = 0; i <= c; i++)		for(int j = 0; j <= d; j++)		dp[i][j] = 0;
	dp[a][b] = 1;

	for(ll i = a; i <= c; i++) {
		for(ll j = b;  j <= d; j++) {
			if(i == a and j == b) continue;
			dp[i][j] = 0;
			dp[i][j] = dp[i - 1][j] + dp[i][j - 1];
			dp[i][j] += dp[i][j - 1] * (i - 1) ;
			dp[i][j] += dp[i -1 ][j] * (j - 1);
			dp[i][j] -= dp[i - 1][j - 1] * (i - 1) * (j - 1);
		}
	}

	cout << dp[c][d];
}



Measured memory_bytes: 74436