#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>

using std::cin;using std::cout;using std::endl;using std::cerr;

typedef long long ll;

const ll mod = 998244353,mmax = 3000;

ll a,b,c,d;
ll dp[mmax + 10][mmax + 10];

int main(){

	std::ios::sync_with_stdio(0);
	cin.tie(0);

	cin>>a>>b>>c>>d;
	dp[a][b] = 1;

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

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

	return 0;
}
