#include #include #include // O(2^(X + Y)) fast solution template struct ModInt { using lint = long long; int val; constexpr ModInt() : val(0) {} constexpr ModInt &_setval(lint v) { val = (v >= mod ? v - mod : v); return *this; } constexpr ModInt(lint v) { _setval(v % mod + mod); } constexpr ModInt operator+(const ModInt &x) const { return ModInt()._setval((lint)val + x.val); } constexpr ModInt operator-(const ModInt &x) const { return ModInt()._setval((lint)val - x.val + mod); } constexpr ModInt operator*(const ModInt &x) const { return ModInt()._setval((lint)val * x.val % mod); } constexpr ModInt operator-() const { return ModInt()._setval(mod - val); } constexpr ModInt &operator+=(const ModInt &x) { return *this = *this + x; } constexpr ModInt &operator-=(const ModInt &x) { return *this = *this - x; } constexpr ModInt &operator*=(const ModInt &x) { return *this = *this * x; } friend std::ostream &operator<<(std::ostream &os, const ModInt &x) { os << x.val; return os; } constexpr ModInt pow(lint n) const { lint ans = 1, tmp = this->val; n %= (mod - 1); while (n) { if (n & 1) ans = ans * tmp % mod; tmp = tmp * tmp % mod; n /= 2; } return ans; } constexpr ModInt inv() const { return this->pow(mod - 2); } }; constexpr int md = 998244353; using mint = ModInt; int main() { int X, Y; long long T; long long a, b, c, d; std::cin >> X >> Y >> T >> a >> b >> c >> d; mint primitive_root = 3; mint rx = primitive_root.pow((md - 1) / (1 << (X + 1))), rxi = rx.inv(); mint ry = primitive_root.pow((md - 1) / (1 << (Y + 1))), ryi = ry.inv(); mint rxa = rx.pow(a), rxai = rxa.inv(); mint ryb = ry.pow(b), rybi = ryb.inv(); mint rxci = rxi.pow(c); mint rydi = ryi.pow(d); mint rxpow = 1, rxpowi = 1, rypow, rypowi; mint rxapow = 1, rxapowi = 1, rybpow, rybpowi; mint rxcpowi = 1, rydpowi; mint ret = 0; for (int k = 0; k < 1 << (X + 1); k++) { rypow = 1, rypowi = 1; rybpow = 1, rybpowi = 1; rydpowi = 1; for (int l = 0; l < 1 << (Y + 1); l++) { mint fkl = rxpow + rxpowi + rypow + rypowi + 1; mint dp0kl = (rxapow - rxapowi) * (rybpow - rybpowi); ret += fkl.pow(T) * dp0kl * rxcpowi * rydpowi; rypow *= ry, rypowi *= ryi; rybpow *= ryb, rybpowi *= rybi; rydpowi *= rydi; } rxpow *= rx, rxpowi *= rxi; rxapow *= rxa, rxapowi *= rxai; rxcpowi *= rxci; } std::cout << ret * mint(1 << (X + Y + 2)).inv() << '\n'; }