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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define INF LLONG_MAX/2
#define PI acos(-1.0)
#define SUM(v) accumulate((v).begin(),(v).end(),0ll)
#define range(i,left,right) (left<=i && i<right)
//#define MOD 1000000007
#define MOD 998244353

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<VVi> VVVi;
typedef vector<Pii> VPii;
typedef vector<double> Vd;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;
typedef priority_queue<int,vector<int>,greater<int>> PQiR;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
void vin(Vi &v){int n=v.size();REP(i,0,n)cin>>v[i];}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m=MOD){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int iscount(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

struct mint{int x;mint(int x=0):x((x%MOD+MOD)%MOD){}
mint operator-()const{return mint(-x);}
mint& operator+=(const mint a){if((x+=a.x)>=MOD)x-=MOD;return*this;}
mint& operator-=(const mint a){if((x+=MOD-a.x)>=MOD)x-=MOD;return*this;}
mint& operator*=(const mint a){(x*=a.x)%=MOD;return*this;}
mint operator+(const mint a)const{return mint(*this)+=a;}
mint operator-(const mint a)const{return mint(*this)-=a;}
mint operator*(const mint a)const{return mint(*this)*=a;}
mint pow(int t)const{if(!t)return 1;mint a=pow(t>>1);a*=a;if(t&1)a*=*this;return a;}
mint inv()const{return pow(MOD-2);}
mint& operator/=(const mint a){return*this*=a.inv();}
mint operator/(const mint a)const{return mint(*this)/=a;}};
istream& operator>>(istream& is, const mint& a) {return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) {return os << a.x;}
typedef vector<mint> Vmi;
typedef vector<Vmi> VVmi;
void vout(Vmi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVmi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}

signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    vector<vector<Tiii>> dp(c+1,vector<Tiii>(d+1)); //tuple(一番下列に2個以上黒マス,一番右列に黒マス2つ,その他)

    dp[a-1][b-1]=mt(0,0,1);
    REP(i,a,c){
        dp[i][b-1]=mt(0,0,(get<2>(dp[i-1][b-1])*b)%MOD);
    }
    REP(j,b,d){
        dp[a-1][j]=mt(0,0,(get<2>(dp[a-1][j-1])*a)%MOD);
    }

    REP(i,a,c){
        REP(j,b,d){
            int t0=0,t1=0,t2=0;
            t0 += get<0>(dp[i][j-1])*(i+1) + get<1>(dp[i][j-1])+get<2>(dp[i][j-1]);
            t1 += get<1>(dp[i-1][j])*(j+1) + get<0>(dp[i-1][j])+get<2>(dp[i-1][j]);
            t2 = (get<1>(dp[i][j-1])+get<2>(dp[i][j-1]))*i;
            dp[i][j]=mt(t0%MOD,t1%MOD,t2%MOD);
        }
    }

    // REP(i,0,c){
    //     REP(j,0,d){
    //         cout<<get<0>(dp[i][j])<<" ";
    //     }
    //     cout<<endl;
    // }
    // cout<<endl;
    // REP(i,0,c){
    //     REP(j,0,d){
    //         cout<<get<1>(dp[i][j])<<" ";
    //     }
    //     cout<<endl;
    // }
    // cout<<endl;
    // REP(i,0,c){
    //     REP(j,0,d){
    //         cout<<get<2>(dp[i][j])<<" ";
    //     }
    //     cout<<endl;
    // }
    cout<<(get<0>(dp[c-1][d-1])+get<1>(dp[c-1][d-1])+get<2>(dp[c-1][d-1]))%MOD<<endl;
    return 0;
}

Measured memory_bytes: 214300