#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <iomanip>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;

class modInt{
    ll value;
    static const ll mod = 998244353;

public:
    modInt(ll x=0): value{x % mod}{}

    inline modInt& operator+=(modInt x){
        value = (value + x.value) % mod;
        return *this;
    }

    inline modInt& operator-=(modInt x){
        value = (value + mod - x.value) % mod;
        return *this;
    }

    inline modInt& operator*=(modInt x){
        value = (value * x.value) % mod;
        return *this;
    }


    inline modInt operator/=(modInt x){
        *this *= x.inv();
        return *this;
    }

    inline modInt pow(ll n){
        modInt res = modInt(1LL);
        modInt x{value};
        while(n > 0){
            if(n & 1)   res *= x;
            x *= x;
            n >>= 1;
        }
        return res;
    }

    inline modInt inv(){
        modInt res = pow(mod-2);
        return res;
    }

    inline ll get(){
        return value;
    }
};

modInt operator+(modInt x, modInt y){
    return x += y;
}

modInt operator-(modInt x, modInt y){
    return x -= y;
}

modInt operator*(modInt x, modInt y){
    return x *= y;
}

modInt operator/(modInt x, modInt y){
    return x /= y;
}

ostream& operator<<(ostream& os, modInt x){
    return os << x.get();
}


class modIntCombinations{
    vector<modInt> factArray;

    void make_fact(ll x){
        for(auto i = factArray.size(); i <= x+1; i++){
            modInt y = factArray[i-1] * i;
            factArray.push_back(y);
        }
    }

public:
    modIntCombinations(){
        factArray.emplace_back(1);
    }

    modInt fact(ll x){
        if(factArray.size() < x+1){
            make_fact(x);
        }
        return factArray[x];
    }

    modInt comb(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k) / fact(n - k);
        }
    }

    modInt perm(ll n, ll k){
        if(n < k){
            return modInt{0};
        }
        else{
            return fact(n) / fact(k);
        }
    }
};


int main(){
    ll a, b, c, d;  cin >> a >> b >> c >> d;
    vector<vector<vector<modInt>>> dp(c+1, vector<vector<modInt>>(d+1, vector<modInt>(3, 0)));

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

//    for(int i = 1; i <= c; i++){
//        for(int j = 1; j <= d; j++){
//            cout << dp[i][j][0] + dp[i][j][1] + dp[i][j][2] << " ";
//        }
//        cout << endl;
//    }
    cout << dp[c][d][0] + dp[c][d][1] + dp[c][d][2] << endl;


    return 0;
}


Measured memory_bytes: 496020