#!/usr/bin/env python3 import numpy as np class NTT(): def __init__(self, D, MOD, root): self.md = MOD self.w = np.array([1], np.int64) self.iw = np.array([1], np.int64) while len(self.w) < 1 << (D - 1): dw = pow(root, (self.md - 1) // (len(self.w) * 4), self.md) dwinv = pow(dw, -1, self.md) self.w = np.r_[self.w, self.w * dw] % self.md self.iw = np.r_[self.iw, self.iw * dwinv] % self.md def ntt(self, mat): in_shape = mat.shape n = in_shape[-1] m = n // 2 while m: mat = mat.reshape(-1, n // (m * 2), 2, m) w_use = self.w[:n // (m * 2)].reshape(1, -1, 1) y = mat[:, :, 1] * w_use % self.md mat = np.stack((mat[:, :, 0] + y, mat[:, :, 0] + self.md - y), 2) % self.md m //= 2 return mat.reshape(in_shape) def intt(self, mat): in_shape = mat.shape n = in_shape[-1] m = 1 while m < n: mat = mat.reshape(-1, n // (m * 2), 2, m) iw_use = self.iw[:n // (m * 2)].reshape(1, -1, 1) mat = np.stack((mat[:, :, 0] + mat[:, :, 1], (mat[:, :, 0] + self.md - mat[:, :, 1]) * iw_use), 2) % self.md m *= 2 n_inv = pow(n, -1, self.md) return mat.reshape(in_shape) * n_inv % self.md X, Y, T, a, b, c, d = list(map(int, input().split())) md = 998244353 T = (T - 1) % (md - 1) + 1 H, W = 1 << (X + 1), 1 << (Y + 1) dp = np.zeros((H, W), np.int64) trans = np.zeros((H, W), np.int64) dp[a, b] = dp[-a, -b] = 1 dp[a, -b] = dp[-a, b] = md - 1 trans[0, 0] = trans[0, 1] = trans[0, -1] = trans[1, 0] = trans[-1, 0] = 1 ntt = NTT(18, md, 3) dp = ntt.ntt(dp) trans = ntt.ntt(trans) dp = dp.T trans = trans.T dp = ntt.ntt(dp) trans = ntt.ntt(trans) def matpow(x, n, mod): ret, tmp = np.ones(x.shape, np.int64), x % mod while n: if n % 2: ret = ret * tmp % mod tmp = tmp * tmp % mod n //= 2 return ret dp = dp * matpow(trans, T, md) % md dp = ntt.intt(dp) dp = dp.T dp = ntt.intt(dp) print(dp[c][d])