We have a grid with A horizontal rows and B vertical columns, with the squares painted white. On this grid, we will repeatedly apply the following operation:

* Assume that the grid currently has a horizontal rows and b vertical columns. Choose "vertical" or "horizontal".
* If we choose "vertical", insert one row at the top of the grid, resulting in an (a+1) \times b grid.
* If we choose "horizontal", insert one column at the right end of the grid, resulting in an a \times (b+1) grid.
* Then, paint one of the added squares black, and the other squares white.



Assume the grid eventually has C horizontal rows and D vertical columns. Find the number of ways in which the squares can be painted in the end, modulo 998244353.

Constraints

* 1 \leq A \leq C \leq 3000
* 1 \leq B \leq D \leq 3000
* A, B, C, and D are integers.

Input

Input is given from Standard Input in the following format:


A B C D


Output

Print the number of ways in which the squares can be painted in the end, modulo 998244353.

Examples

Input

1 1 2 2


Output

3


Input

2 1 3 4


Output

65


Input

31 41 59 265


Output

387222020

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
(A, B, C, D) = map(int, input().split())
mod = 998244353
dp = [[0 for y in range(D - B + 1)] for x in range(C - A + 1)]
dp[0][0] = 1
for x in range(C - A):
	dp[x + 1][0] = dp[x][0] * B % mod
for y in range(D - B):
	dp[0][y + 1] = dp[0][y] * A % mod
for x in range(C - A):
	for y in range(D - B):
		dp[x + 1][y + 1] = dp[x + 1][y] * (A + x) % mod
		dp[x + 1][y + 1] += dp[x][y + 1] * (B + y) % mod
		dp[x + 1][y + 1] %= mod
		dp[x + 1][y + 1] -= dp[x][y] * (A + x) * (B + y) % mod
		dp[x + 1][y + 1] %= mod
		dp[x + 1][y + 1] += (dp[x + 1][y] + dp[x][y + 1]) % mod
		dp[x + 1][y + 1] %= mod
print(dp[C - A][D - B])


(a, b, c, d) = map(int, input().split())
MOD = 998244353
dp = [[0] * (d - b + 1) for _ in range(c - a + 1)]
dp[0][0] = 1
for x in range(1, d - b + 1):
	dp[0][x] = dp[0][x - 1] * a % MOD
for y in range(1, c - a + 1):
	dp[y][0] = dp[y - 1][0] * b % MOD
for x in range(1, c - a + 1):
	for y in range(1, d - b + 1):
		dp[x][y] = (dp[x - 1][y] * (b + y) + dp[x][y - 1] * (a + x) - dp[x - 1][y - 1] * (a + x - 1) * (b + y - 1)) % MOD
print(dp[-1][-1])


(A, B, C, D) = map(int, input().split())
P = 998244353
dp = [[0 for j in range(3002)] for i in range(3002)]
dp[A][B] = 1
for row in range(A, C + 1):
	for col in range(B, D + 1):
		dp[row][col] += col * dp[row - 1][col] + row * dp[row][col - 1]
		dp[row][col] -= (row - 1) * (col - 1) * dp[row - 1][col - 1]
		dp[row][col] %= P
print(dp[C][D])


import sys
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 998244353
input = lambda : sys.stdin.readline().rstrip()
YesNo = lambda b: bool([print('Yes')] if b else print('No'))
YESNO = lambda b: bool([print('YES')] if b else print('NO'))
int1 = lambda x: int(x) - 1
(a, b, c, d) = map(int, input().split())
MAX = 3050
dp = [[0] * MAX for _ in range(MAX)]
dp[a][b] = 1
for i in range(a, c + 1):
	for j in range(b, d + 1):
		dp[i][j] += dp[i][j - 1] * i + dp[i - 1][j] * j - dp[i - 1][j - 1] * (i - 1) * (j - 1)
		dp[i][j] %= MOD
print(dp[c][d])


MOD = 998244353

def fastExponentiation(a, b, N):
	ans = 1
	bDiv2 = b
	aPow2 = a
	while bDiv2 > 0:
		if bDiv2 % 2 != 0:
			ans *= aPow2
			ans %= N
		bDiv2 //= 2
		aPow2 = aPow2 * aPow2
		aPow2 %= N
	return ans
(a, b, c, d) = map(int, input().split())
DP = []
for i in range(c - a + 1):
	DP.append([])
	for j in range(d - b + 1):
		DP[i].append(0)
for i in range(c - a + 1):
	partialSum = 0
	if i == 0:
		DP[i][0] = 1
		continue
	for j in range(d - b + 1):
		if j == 0:
			DP[i][j] = DP[i - 1][j] * b % MOD
		else:
			partialSum += DP[i - 1][j - 1]
			partialSum *= a + i - 1
			partialSum %= MOD
			DP[i][j] = (DP[i - 1][j] * (j + b) + partialSum) % MOD
ans = 0
for j in range(d - b + 1):
	ans = ans + DP[c - a][j] * fastExponentiation(c, d - b - j, MOD)
	ans %= MOD
print(ans)


import bisect
import copy
import heapq
import sys
import itertools
import math
import queue
from functools import lru_cache
input = sys.stdin.readline
sys.setrecursionlimit(1000000)
mod = 998244353

def read_values():
	return map(int, input().split())

def read_index():
	return map(lambda x: int(x) - 1, input().split())

def read_list():
	return list(read_values())

def read_lists(N):
	return [read_list() for n in range(N)]

def main():
	(A, B, C, D) = read_values()
	dp = [[0 for _ in range(D - B + 1)] for _ in range(C - A + 1)]
	dp[0][0] = 1
	for i in range(C - A):
		dp[i + 1][0] = dp[i][0] * B % mod
	for j in range(D - B):
		dp[0][j + 1] = dp[0][j] * A % mod
	for i in range(1, C - A + 1):
		for j in range(1, D - B + 1):
			dp[i][j] = dp[i - 1][j] * (B + j) % mod + dp[i][j - 1] * (A + i) % mod - dp[i - 1][j - 1] * (A + i - 1) * (B + j - 1) % mod
			dp[i][j] %= mod
	print(dp[C - A][D - B] % mod)
main()


MOD = 998244353
(A, B, C, D) = map(int, input().split())
dp = [[0] * (D - B + 1) for _ in range(C - A + 1)]
dp[0][0] = 1
for i in range(1, C - A + 1):
	dp[i][0] = dp[i - 1][0] * B
	dp[i][0] %= MOD
for i in range(1, D - B + 1):
	dp[0][i] = dp[0][i - 1] * A
	dp[0][i] %= MOD
for a in range(A, C):
	for b in range(B, D):
		dp[a - A + 1][b - B + 1] = dp[a - A][b - B + 1] * (b + 1) + dp[a - A + 1][b - B] * (a + 1) - dp[a - A][b - B] * a * b
		dp[a - A + 1][b - B + 1] %= MOD
print(dp[C - A][D - B])


import sys
input = sys.stdin.readline
(a, b, c, d) = map(int, input().split())
dp = [[0] * (d - b + 1) for _ in range(c - a + 1)]
dp[0][0] = 1
for i in range(c - a + 1):
	for j in range(d - b + 1):
		if i > 0:
			dp[i][j] += dp[i - 1][j] * (b + j)
		if j > 0:
			dp[i][j] += dp[i][j - 1] * (a + i)
		if i > 0 and j > 0:
			dp[i][j] -= dp[i - 1][j - 1] * (b + j - 1) * (a + i - 1)
		dp[i][j] %= 998244353
print(dp[-1][-1])


(a, b, c, d) = [int(x) for x in input().split()]
MOD = 998244353
dp = [[0 for i in range(d + 10)] for j in range(c + 10)]
for i in range(a, c + 1):
	for j in range(b, d + 1):
		if i == a and j == b:
			dp[i][j] = 1
			continue
		dp[i][j] = dp[i - 1][j] * j + dp[i][j - 1] * i - dp[i - 1][j - 1] * (i - 1) * (j - 1)
		dp[i][j] %= MOD
print(dp[c][d])


(a, b, c, d) = map(int, input().split())
p = 998244353
n = c - a + 2
m = d - b + 2
data = [[0] * m for i in range(n)]
data[1][1] = 1
for i in range(1, n):
	gyou = a + i - 1
	for j in range(1, m):
		retu = b + j - 1
		if i * j == 1:
			continue
		data[i][j] = data[i - 1][j] * retu % p + data[i][j - 1] * gyou % p - data[i - 1][j - 1] * (gyou - 1) % p * (retu - 1) % p
		data[i][j] = data[i][j] % p
print(data[n - 1][m - 1] % p)


import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate

def mina(*argv, sub=1):
	return list(map(lambda x: x - sub, argv))

def read_a_int():
	return int(read())

def read_ints():
	return list(map(int, read().split()))

def read_col(H):
	ret = []
	for _ in range(H):
		ret.append(list(map(int, read().split())))
	return tuple(map(list, zip(*ret)))

def read_tuple(H):
	ret = []
	for _ in range(H):
		ret.append(tuple(map(int, read().split())))
	return ret

def read_matrix(H):
	ret = []
	for _ in range(H):
		ret.append(list(map(int, read().split())))
	return ret

def combination_mod(n, r, mod=998244353):
	if r > n:
		return 0
	r = min(r, n - r)
	nf = rf = 1
	for i in range(r):
		nf = nf * (n - i) % mod
		rf = rf * (i + 1) % mod
	return nf * pow(rf, mod - 2, mod) % mod
MOD = 998244353
INF = 2 ** 31
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right
from math import gcd
(A, B, C, D) = read_ints()
i_max = C - A
j_max = D - B
dp = [[0] * (j_max + 1) for _ in ra(i_max + 1)]
for i in ra(i_max + 1):
	dp[i][0] = pow(B, i, MOD)
for j in ra(j_max + 1):
	dp[0][j] = pow(A, j, MOD)
for (i, j) in product(range(1, i_max + 1), range(1, j_max + 1)):
	dp[i][j] = dp[i][j - 1] * (A + i) + dp[i - 1][j] * (B + j) - (A + i - 1) * (B + j - 1)
	dp[i][j] = dp[i][j - 1] * (A + i) + dp[i - 1][j] * (B + j) - (A + i - 1) * (B + j - 1) * dp[i - 1][j - 1]
	dp[i][j] %= MOD
print(dp[-1][-1])


(a, b, c, d) = map(int, input().split())
dp = [[1] * (d - b + 1) for _ in range(c - a + 1)]
mod = 998244353
for h in range(1, c - a + 1):
	dp[h][0] = pow(b, h, mod)
for w in range(1, d - b + 1):
	dp[0][w] = pow(a, w, mod)
for w in range(1, d - b + 1):
	for h in range(1, c - a + 1):
		dp[h][w] = dp[h][w - 1] * (h + a) + dp[h - 1][w] * (w + b) - dp[h - 1][w - 1] * (w + b - 1) * (h + a - 1)
		dp[h][w] %= mod
print(dp[c - a][d - b])


mod = 998244353
(A, B, C, D) = map(int, input().split())
X = D - B
Y = C - A
if X == 0:
	print(pow(B, Y, mod))
	exit()
if Y == 0:
	print(pow(A, X, mod))
	exit()
dp = [B, A]
for x in range(1, X):
	dp.append(dp[-1] * A % mod)
for y in range(1, Y):
	dp_new = [None] * (X + 1)
	dp_new[0] = dp[0] * B % mod
	a = 0
	for x in range(1, X + 1):
		a = (a + dp[x - 1]) * (A + y) % mod
		b = dp[x] * (B + x) % mod
		dp_new[x] = (a + b) % mod
	dp = dp_new
k = 1
ans = 0
for d in dp[::-1]:
	ans += d * k
	ans %= mod
	k *= C
	k %= mod
print(ans)


def main():
	(A, B, C, D) = map(int, input().split())
	c = C - A
	d = D - B
	mod = 998244353
	dp = [[0] * (d + 1) for i in range(c + 1)]
	dp[0][0] = 1
	for i in range(c + 1):
		for j in range(d + 1):
			ret = 0
			if i == 0 and j == 0:
				continue
			if i > 0 and j > 0:
				if i == j == 1:
					ret -= (A + i - 1) * (B + j - 1)
				else:
					ret -= dp[i - 1][j - 1]
					ret *= (A + i - 1) * (B + j - 1)
			ret += dp[i - 1][j] * (B + j) + dp[i][j - 1] * (A + i)
			ret %= mod
			dp[i][j] = ret
	print(dp[c][d])
main()


import sys
input = sys.stdin.readline
import math
import bisect
import heapq
from collections import defaultdict
from collections import deque
from collections import Counter
from functools import lru_cache
MOD = 10 ** 9 + 7
INF = float('inf')
AZ = 'abcdefghijklmnopqrstuvwxyz'

def I():
	return int(input().strip())

def S():
	return input().strip()

def IL():
	return list(map(int, input().split()))

def SL():
	return list(map(str, input().split()))

def ILs(n):
	return list((int(input()) for _ in range(n)))

def SLs(n):
	return list((input().strip() for _ in range(n)))

def ILL(n):
	return [list(map(int, input().split())) for _ in range(n)]

def SLL(n):
	return [list(map(str, input().split())) for _ in range(n)]

def P(arg):
	print(arg)
	return

def Y():
	print('Yes')
	return

def N():
	print('No')
	return

def E():
	exit()

def PE(arg):
	print(arg)
	exit()

def YE():
	print('Yes')
	exit()

def NE():
	print('No')
	exit()

def DD(arg):
	return defaultdict(arg)

def inv(n):
	return pow(n, MOD - 2, MOD)
kaijo_memo = []

def kaijo(n):
	if len(kaijo_memo) > n:
		return kaijo_memo[n]
	if len(kaijo_memo) == 0:
		kaijo_memo.append(1)
	while len(kaijo_memo) <= n:
		kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
	return kaijo_memo[n]
gyaku_kaijo_memo = []

def gyaku_kaijo(n):
	if len(gyaku_kaijo_memo) > n:
		return gyaku_kaijo_memo[n]
	if len(gyaku_kaijo_memo) == 0:
		gyaku_kaijo_memo.append(1)
	while len(gyaku_kaijo_memo) <= n:
		gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo), MOD - 2, MOD) % MOD)
	return gyaku_kaijo_memo[n]

def nCr(n, r):
	if n == r:
		return 1
	if n < r or r < 0:
		return 0
	ret = 1
	ret = ret * kaijo(n) % MOD
	ret = ret * gyaku_kaijo(r) % MOD
	ret = ret * gyaku_kaijo(n - r) % MOD
	return ret

def factorization(n):
	arr = []
	temp = n
	for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
		if temp % i == 0:
			cnt = 0
			while temp % i == 0:
				cnt += 1
				temp //= i
			arr.append([i, cnt])
	if temp != 1:
		arr.append([temp, 1])
	if arr == []:
		arr.append([n, 1])
	return arr

def make_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors

def make_primes(N):
	max = int(math.sqrt(N))
	seachList = [i for i in range(2, N + 1)]
	primeNum = []
	while seachList[0] <= max:
		primeNum.append(seachList[0])
		tmp = seachList[0]
		seachList = [i for i in seachList if i % tmp != 0]
	primeNum.extend(seachList)
	return primeNum

def gcd(a, b):
	while b:
		(a, b) = (b, a % b)
	return a

def lcm(a, b):
	return a * b // gcd(a, b)

def count_bit(n):
	count = 0
	while n:
		n &= n - 1
		count += 1
	return count

def base_10_to_n(X, n):
	if X // n:
		return base_10_to_n(X // n, n) + [X % n]
	return [X % n]

def base_n_to_10(X, n):
	return sum((int(str(X)[-i - 1]) * n ** i for i in range(len(str(X)))))

def int_log(n, a):
	count = 0
	while n >= a:
		n //= a
		count += 1
	return count
(A, B, C, D) = IL()
(H, W) = (C - A + 1, D - B + 1)
dp = [[0 for w in range(W)] for h in range(H)]
for w in range(W):
	dp[0][w] = pow(A, w, 998244353)
for h in range(H):
	dp[h][0] = pow(B, h, 998244353)
for w in range(1, W):
	for h in range(1, H):
		dp[h][w] = (dp[h - 1][w] + dp[h][w - 1] + dp[h - 1][w] * (B + w - 1) + dp[h][w - 1] * (A + h - 1) - dp[h - 1][w - 1] * (B + w - 1) * (A + h - 1)) % 998244353
print(dp[-1][-1])


(a, b, c, d) = map(int, input().split())
m = c - a
n = d - b
t = [[1]]
for i in range(m):
	t[0].append(b * t[0][i] % 998244353)
for i in range(n):
	t.append([a * t[i][0] % 998244353] + [0] * m)
for i in range(1, n + 1):
	for j in range(1, m + 1):
		t[i][j] = t[i][j - 1] * (b + i) + t[i - 1][j] * (a + j) - t[i - 1][j - 1] * ((a + j - 1) * (b + i - 1))
		t[i][j] %= 998244353
print(t[n][m])


M = 998244353
(A, B, C, D) = map(int, input().split())
table_a = [None] * (D - B + 1)
table_h = [None] * (D - B + 1)
table_v = [None] * (D - B + 1)
tmp_table_a = [None] * (D - B + 1)
tmp_table_h = [None] * (D - B + 1)
tmp_table_v = [None] * (D - B + 1)
table_a[0] = 1
c = 1
for x in range(1, D - B + 1):
	c = c * A % M
	table_a[x] = c
	table_v[x] = c
c = 1
for y in range(1, C - A + 1):
	c = c * B % M
	tmp_table_a[0] = c
	tmp_table_h[0] = c
	for x in range(1, D - B + 1):
		tmp_table_v[x] = tmp_table_a[x - 1] * (A + y) % M
		tmp_table_h[x] = table_a[x] * (B + x) % M
		tmp_table_a[x] = (tmp_table_h[x] + (tmp_table_a[x - 1] - tmp_table_h[x - 1]) * (A + y) + tmp_table_h[x - 1]) % M
	(table_a, tmp_table_a) = (tmp_table_a, table_a)
	(table_v, tmp_table_v) = (tmp_table_v, table_v)
	(table_h, tmp_table_h) = (tmp_table_h, table_h)
print(table_a[D - B])


(A, B, C, D) = map(int, input().split())
MOD = 998244353
a = 1
arr = []
for j in range(D - B + 1):
	arr.append(a)
	a *= A
	a %= MOD
dp = [arr]
b = B
for i in range(1, C - A + 1):
	arr = [b]
	for j in range(1, D - B + 1):
		x = arr[-1]
		y = dp[-1][j]
		z = dp[-1][j - 1]
		h = A + i
		w = B + j
		arr.append((x * h + y * w - z * ((h - 1) * (w - 1))) % MOD)
	b *= B
	b %= MOD
	dp.append(arr)
print(dp[C - A][D - B])


import sys
sys.setrecursionlimit(10 ** 8)
from functools import lru_cache
INF = float('inf')
MOD = 998244353

def main():
	(A, B, C, D) = map(int, input().split())
	DP = [[1] * (D - B + 1) for _ in range(C - A + 1)]
	for i in range(C - A + 1):
		for j in range(D - B + 1):
			if i == j == 0:
				continue
			DP[i][j] = 0
			if 0 <= i - 1:
				DP[i][j] += DP[i - 1][j] * (j + B) % MOD
				DP[i][j] %= MOD
			if 0 <= j - 1:
				DP[i][j] += DP[i][j - 1] * (i + A) % MOD
				DP[i][j] %= MOD
			if 0 <= i - 1 and 0 <= j - 1:
				DP[i][j] -= DP[i - 1][j - 1] * (i + A - 1) * (j + B - 1) % MOD
				DP[i][j] %= MOD
	print(DP[-1][-1] % MOD)
	return
main()


(a, b, c, d) = [int(_) for _ in input().split()]
mod = 998244353
dp = [0] * 3005
dp[b] = 1
for y in range(b + 1, d + 1):
	dp[y] = dp[y - 1] * a % mod
for x in range(a + 1, c + 1):
	dp2 = [0] * 3005
	dp2[b] = dp[b] * b % mod
	for y in range(b + 1, d + 1):
		dp2[y] = (dp[y] * y + dp2[y - 1] * x - dp[y - 1] * (x - 1) * (y - 1)) % mod
	dp = dp2
print(dp[d])


import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda : readline().rstrip()
ni = lambda : int(readline().rstrip())
nm = lambda : map(int, readline().split())
nl = lambda : list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

def solve():
	mod = 998244353
	(a, b, c, d) = nm()
	(n, m) = (c - a, d - b)
	dp = [[0] * (m + 1) for _ in range(n + 1)]
	dp[0][0] = 1
	for i in range(n):
		dp[i + 1][0] = dp[i][0] * b % mod
	for i in range(m):
		dp[0][i + 1] = dp[0][i] * a % mod
	for i in range(1, n + 1):
		for j in range(1, m + 1):
			dp[i][j] = (dp[i][j - 1] * (a + i) + dp[i - 1][j] * (b + j) - dp[i - 1][j - 1] * (a + i - 1) * (b + j - 1)) % mod
	print(dp[n][m])
	return
solve()


mod = 998244353
(a, b, c, d) = map(int, input().split())
dp0 = [0] * (c - a + 1)
dp1 = [1]
for i in range(c - a):
	dp1.append(dp1[-1] * b % mod)
for j in range(1, d - b + 1):
	new_dp0 = [(dp0[0] * a + dp1[0]) % mod]
	new_dp1 = [dp1[0] * (a - 1) % mod]
	for i in range(1, c - a + 1):
		new_dp0.append((dp0[i] * (a + i) + dp1[i]) % mod)
		new_dp1.append((new_dp0[-2] + new_dp1[-1]) * (b + j) % mod)
	dp0 = new_dp0
	dp1 = new_dp1
print((dp0[-1] + dp1[-1]) % mod)


(a, b, c, d) = map(int, input().split())
mod = 998244353
dp = [[0 for _ in range(c - a + 1)] for _ in range(d - b + 1)]
dp[0][0] = 1
for j in range(c - a + 1):
	for i in range(d - b + 1):
		if i == j == 0:
			dp[i][j] = 1
		elif i == 0:
			dp[i][j] = dp[i][j - 1] * b % mod
		elif j == 0:
			dp[i][j] = dp[i - 1][j] * a % mod
		else:
			tmp1 = (j + a - 1) * dp[i - 1][j] % mod
			tmp2 = (i + b - 1) * dp[i][j - 1] % mod
			tmp3 = -dp[i - 1][j - 1] * (i + b - 1) * (j + a - 1) % mod
			tmp4 = (dp[i - 1][j] + dp[i][j - 1]) % mod
			dp[i][j] = (tmp1 + tmp2 + tmp3 + tmp4) % mod
print(dp[-1][-1])


Q = 998244353

def main():
	(A, B, C, D) = map(int, input().split())
	dp = [[0] * 3002 for _ in range(3001)]
	dp[C][D] = 1
	for a in range(C - 1, A - 1, -1):
		dp[a][D] = dp[a + 1][D] * D % Q
	for b in range(D - 1, B - 1, -1):
		dp[C][b] = dp[C][b + 1] * C % Q
	for a in range(C - 1, A - 1, -1):
		z = dp[a + 1][D] * a % Q
		for b in range(D - 1, B - 1, -1):
			dp[a][b] = (b * dp[a + 1][b] + z) % Q
			z = (z + dp[a + 1][b]) * a % Q
	print(dp[A][B])
main()


import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

def main():
	(A, B, C, D) = [int(x) for x in input().split()]
	MOD = 998244353
	dp = [[0] * (D - B + 1) for j in range(C - A + 1)]
	for j in range(C - A + 1):
		if j == 0:
			dp[j][0] = 1
		else:
			dp[j][0] = pow(B, j, MOD)
		for i in range(1, D - B + 1):
			if j == 0:
				dp[j][i] = dp[j][i - 1] * (A + j) % MOD
			else:
				dp[j][i] = (dp[j][i - 1] * (A + j) + (B + i) * dp[j - 1][i] - dp[j - 1][i - 1] * ((A + j - 1) * (B + i - 1))) % MOD
	print(dp[-1][-1] % MOD)
main()


import sys, collections as cl, bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 998244353
Max = sys.maxsize

def l():
	return list(map(int, input().split()))

def m():
	return map(int, input().split())

def onem():
	return int(input())

def s(x):
	a = []
	if len(x) == 0:
		return []
	aa = x[0]
	su = 1
	for i in range(len(x) - 1):
		if aa != x[i + 1]:
			a.append([aa, su])
			aa = x[i + 1]
			su = 1
		else:
			su += 1
	a.append([aa, su])
	return a

def jo(x):
	return ' '.join(map(str, x))

def max2(x):
	return max(map(max, x))

def In(x, a):
	k = bs.bisect_left(a, x)
	if k != len(a) and a[k] == x:
		return True
	else:
		return False

def pow_k(x, n):
	ans = 1
	while n:
		if n % 2:
			ans *= x
		x *= x
		n >>= 1
	return ans
(a, b, c, d) = m()
ans = 0
po = c - a
poo = d - b
dp = [[0 for i in range(poo + 1)] for j in range(po + 1)]
dp[0][0] = 1
for i in range(po + 1):
	for j in range(poo + 1):
		if i == 0:
			if j != 0:
				dp[i][j] = dp[i][j - 1] * a
				dp[i][j] %= mod
		elif j == 0:
			dp[i][j] = dp[i - 1][j] * b
			dp[i][j] %= mod
		else:
			dp[i][j] = dp[i - 1][j] * (b + j) + dp[i][j - 1] * (a + i) - (a + i - 1) * (b + j - 1) * dp[i - 1][j - 1]
			dp[i][j] %= mod
print(dp[-1][-1])


import sys
MOD = 998244353

def main(A, B, C, D):
	(I, J) = (C - A, D - B)
	dp = [[0] * (I + 1) for _ in range(I + J + 1)]
	dp[0][0] = 1
	for k in range(1, I + J + 1):
		for i in range(min(I, k) + 1):
			j = k - i
			v = dp[k - 1][i - 1] * (j + B) % MOD if i >= 1 else 0
			h = dp[k - 1][i] * (i + A) % MOD
			d = dp[k - 2][i - 1] * (i + A - 1) * (j + B - 1) if k >= 2 and i >= 1 else 0
			dp[k][i] = (v + h - d) % MOD
	print(dp[I + J][I])
input = sys.stdin.readline
(A, B, C, D) = map(int, input().split())
main(A, B, C, D)


(a, b, c, d) = map(int, input().split())
dp = [[1 for _ in range(d - b + 1)] for _ in range(c - a + 1)]
mod = 998244353
for x in range(c - a + 1):
	for y in range(d - b + 1):
		if x == 0:
			if y > 0:
				dp[x][y] = dp[x][y - 1] * (a + x) % mod
		elif y == 0:
			dp[x][y] = dp[x - 1][y] * (b + y) % mod
		else:
			dp[x][y] = (dp[x - 1][y] * (b + y) + dp[x][y - 1] * (a + x) - dp[x - 1][y - 1] * (a + x - 1) * (b + y - 1)) % mod
print(dp[-1][-1])


MOD = 998244353

def solve(A, B, C, D):
	(H, W) = (C - A, D - B)
	dp = [[0] * (W + 1) for _ in range(H + 1)]
	t = 1
	for i in range(W + 1):
		dp[0][i] = t
		t *= A
		t %= MOD
	for j in range(1, H + 1):
		dp[j][0] = dp[j - 1][0] * B % MOD
		for i in range(1, W + 1):
			dp[j][i] = dp[j - 1][i] * (B + i) + dp[j][i - 1] * (A + j) - dp[j - 1][i - 1] * (B + i - 1) * (A + j - 1)
			dp[j][i] %= MOD
	return dp[-1][-1]
print(solve(*map(int, input().split())))


(a, b, c, d) = map(int, input().split())
mod = 998244353
dp = [[0] * (d - b + 1) for i in range(c - a + 1)]
if a == c and b == d:
	print(1)
elif a == c:
	print(pow(a, d - b, mod))
elif b == d:
	print(pow(b, c - a, mod))
else:
	for i in range(c - a):
		p = 0
		for j in range(d - b + 1):
			if i == j == 0:
				dp[i][j] = 1
			dp[i + 1][j] = (p + dp[i][j] * (b + j)) % mod
			p += dp[i][j]
			p %= mod
			p *= a + i
			p %= mod
	ans = 0
	for d in dp[-1]:
		ans *= c
		ans %= mod
		ans += d
		ans %= mod
	print(ans)