from collections import defaultdict P = 998244353 def naive(): x = abs(x1 - x2) y = abs(y1 - y2) D = defaultdict(int, {(x, y): 1}) ANS = [] for loop in range(n): for _ in range(2): nD = defaultdict(int) for k, v in D.items(): xx, yy = k for nx, ny, prob in ((xx + 1, yy, alpha), (xx - 1, yy, alpha), (xx, yy + 1, beta), (xx, yy - 1, beta)): nxy = (nx, ny) nD[nxy] = (nD[nxy] + v * prob) % P D = nD ANS.append(D[(0, 0)]) D[(0, 0)] = 0 ans = 0 for i in range(n): ans = (ans + ANS[i] * A[i]) % P return ans n = int(input()) x1, y1, x2, y2 = map(int, input().split()) a, b = map(int, input().split()) iv = pow(2 * (a + b), P - 2, P) alpha = a * iv % P beta = b * iv % P A = [int(a) for a in input().split()] print(naive())