#include #include #include using u32 = unsigned; using u64 = unsigned long long; template struct Mint { u32 n; constexpr Mint(u32 n = 0): n(n) {} constexpr Mint &operator+=(const Mint &rhs){ n += rhs.n; if(n >= MOD) n -= MOD; return *this; } constexpr Mint &operator-=(const Mint &rhs){ if(rhs.n > n) n += MOD; n -= rhs.n; return *this; } constexpr Mint &operator*=(const Mint &rhs){ n = (u64) n * rhs.n % MOD; return *this; } friend constexpr Mint operator+(const Mint &lhs, const Mint &rhs){ return Mint(lhs) += rhs; } friend constexpr Mint operator-(const Mint &lhs, const Mint &rhs){ return Mint(lhs) -= rhs; } friend constexpr Mint operator*(const Mint &lhs, const Mint &rhs){ return Mint(lhs) *= rhs; } }; template T pow(T a, u64 n){ T r = 1; for(; n; n >>= 1){ if(n&1) r *= a; a *= a; } return r; } constexpr u32 mod = 998244353; using mint = Mint; constexpr mint root = 3; u64 x, y, t, a, b, c, d; int main(){ std::cin >> x >> y >> t >> a >> b >> c >> d; if(x < y){ std::swap(x, y); std::swap(a, b); std::swap(c, d); } std::vector wx((1 << (x+1)) + 1); const mint rootx = pow(root, (mod-1)/(1 << (x+1))); wx[0] = 1; for(int i = 1; i <= (1 << (x+1)); ++i) wx[i] = wx[i-1] * rootx; t %= mod - 1; const u32 mask = (1 << (x+1)) - 1; mint ans = 0; for(u32 i = 0; i < (1U << x); ++i){ for(u32 j = 0; j < (1U << y); ++j){ u32 ai = a * i; u32 bj = (b * j) << (x-y); u32 ci = c * i; u32 dj = (d * j) << (x-y); u32 jj = j << (x-y); ans += (wx[ai & mask] - wx[-ai & mask]) * (wx[bj & mask] - wx[-bj & mask]) * (wx[ci & mask] - wx[-ci & mask]) * (wx[dj & mask] - wx[-dj & mask]) * pow(wx[i] + wx[-i & mask] + wx[jj] + wx[-jj & mask] + 1, t); } } for(u32 i = 0; i < x + y + 2; ++i){ if(ans.n & 1) ans.n += mod; ans.n /= 2; } std::cout << ans.n << std::endl; return 0; }