local mod = 998244353
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end
local a, b = io.read("*n", "*n")
local c, d = io.read("*n", "*n")
local dp = {}
for i = 1, c do
  dp[i] = {}
  for j = 1, d do
    dp[i][j] = 0
  end
end
dp[a][b] = 1
for ia = a, c do
  for ib = b, d do
    if ia == a then
      if ib == b then
      else
        dp[a][ib] = bmul(dp[a][ib - 1], a)
      end
    elseif ib == b then
      dp[ia][b] = bmul(dp[ia - 1][b], b)
    else
      local v1 = bmul(dp[ia][ib - 1], ia)
      local v2 = bmul(dp[ia - 1][ib], ib)
      local v3 = bmul(dp[ia - 1][ib - 1], bmul(ia - 1, ib - 1))
      v3 = mod - v3
      dp[ia][ib] = badd(v1, badd(v2, v3))
    end
  end
end
print(dp[c][d])
