#include #include using namespace std; const int MOD = 998244353; long long modPow(long long a, long long p){ if(p == 0) return 1; auto res = modPow(a, p/2); res = (res*res)%MOD; if(p%2) res = (res*a)%MOD; return res; } long long calcInv(long long a){ return modPow(a, MOD-2); } void ntt(vector& v, int inv){ const int n = v.size(); auto w = modPow(3, (MOD-1)/n); if(inv == -1) w = calcInv(w); int rev = 0; for(int i=1;i(rev^=j);j/=2); if(i < rev) swap(v[i], v[rev]); } for(int m=1;m>& v, int inv){ for(auto& t : v) ntt(t, inv); vector m(v.size()); for(int i=0;i> mul(const vector>& a, const vector>& b){ auto res = a; for(int i=0;i> pow(const vector>& a, long long p){ if(p == 1) return a; auto r = pow(a, p/2); r = mul(r, r); if(p%2 == 1) r = mul(r, a); return r; } int main(){ int X, Y; while(cin >> X >> Y){ long long T; cin >> T; int a, b, c, d; cin >> a >> b >> c >> d; int N = 1 << (X+1); int M = 1 << (Y+1); vector> f(N, vector(M, 0LL)); f[0][0] = f[0][1] = f[1][0] = f[N-1][0] = f[0][M-1] = 1; vector> g(N, vector(M, 0LL)); g[a][b] = g[N-a][M-b] = 1; g[a][M-b] = g[N-a][b] = MOD - 1; ntt2d(f, 1); ntt2d(g, 1); auto res = mul(pow(f, T), g); ntt2d(res, -1); cout << res[c][d] * calcInv(N*M) % MOD << endl; } }