
import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val mod = 998244353.toLong()

    val a = sc.nextInt()
    val b = sc.nextInt()
    val c = sc.nextInt()
    val d = sc.nextInt()

    val dp = Array(c+1){LongArray(d+1){-1L} }

    fun solve(r:Int, c:Int): Long {
        if(r < a || c < b)
            return 0L
        if(r==a && c == b) {
            return 1L
        }
        if(dp[r][c] != -1L) {
            return dp[r][c]
        }
        // column 붙인 경우
        var cnt = 0L
        cnt += solve(r-1, c) * c
        cnt %= mod
        cnt += solve(r, c - 1) * r
        cnt %= mod
        var x = ((r-1) * (c-1)).toLong()
        x *= solve(r - 1, c - 1)
        x %= mod
        cnt = cnt - x + mod
        cnt %= mod
        dp[r][c] = cnt
        return cnt
    }
    print(solve(c, d))
    //println(".")


    //[a,b] -> [c,d]
    //



}