#include #include #include using namespace std; using mint = atcoder::modint998244353; template void ntt2d(std::vector> &mat) { for (auto &vec : mat) atcoder::internal::butterfly(vec); int h = mat.size(), w = mat[0].size(); for (int j = 0; j < w; j++) { std::vector v(h); for (int i = 0; i < h; i++) v[i] = mat[i][j]; atcoder::internal::butterfly(v); for (int i = 0; i < h; i++) mat[i][j] = v[i]; } } template void ntt2dinv(std::vector> &mat) { int h = mat.size(), w = mat[0].size(); for (int j = 0; j < w; j++) { std::vector v(h); for (int i = 0; i < h; i++) v[i] = mat[i][j]; atcoder::internal::butterfly_inv(v); for (int i = 0; i < h; i++) mat[i][j] = v[i]; } for (auto &vec : mat) atcoder::internal::butterfly_inv(vec); MODINT ninv = MODINT(h * w).inv(); for (auto &vec : mat) { for (auto &x : vec) { x *= ninv; } } } int main() { int X, Y; long long T; int a, b, c, d; cin >> X >> Y >> T >> a >> b >> c >> d; vector dp(1 << (X + 1), vector(1 << (Y + 1))); dp[a][b] = 1; dp[(1 << (X + 1)) - a][(1 << (Y + 1)) - b] = 1; dp[(1 << (X + 1)) - a][b] = -1; dp[a][(1 << (Y + 1)) - b] = -1; vector trans(1 << (X + 1), vector(1 << (Y + 1))); trans[0][0] = trans[0][1] = trans[0][(1 << (Y + 1)) - 1] = trans[1][0] = trans[(1 << (X + 1)) - 1][0] = 1; ntt2d(dp); ntt2d(trans); for (size_t i = 0; i < dp.size(); i++) { for (size_t j = 0; j < dp[i].size(); j++) { dp[i][j] *= trans[i][j].pow(T); } } ntt2dinv(dp); cout << dp[c][d].val() << '\n'; }