#pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; using ll=long long; using datas=pair; using ddatas=pair; using tdata=pair; using vec=vector; using mat=vector; using pvec=vector; using pmat=vector; #define For(i,a,b) for(i=a;i<(ll)b;++i) #define bFor(i,b,a) for(i=b,--i;i>=(ll)a;--i) #define rep(i,N) For(i,0,N) #define rep1(i,N) For(i,1,N) #define brep(i,N) bFor(i,N,0) #define brep1(i,N) bFor(i,N,1) #define all(v) (v).begin(),(v).end() #define allr(v) (v).rbegin(),(v).rend() #define vsort(v) sort(all(v)) #define vrsort(v) sort(allr(v)) #define uniq(v) vsort(v);(v).erase(unique(all(v)),(v).end()) #define endl "\n" #define popcount __builtin_popcountll #define eb emplace_back #define print(x) cout< ostream& operator<<(ostream& os,const pair& p){return os<<"("< ostream& operator<<(ostream& os,const vector& v){ os<<"{";bool f=false; for(auto& x:v){if(f)os<<",";os< ostream& operator<<(ostream& os,const set& v){ os<<"{";bool f=false; for(auto& x:v){if(f)os<<",";os< ostream& operator<<(ostream& os,const multiset& v){ os<<"{";bool f=false; for(auto& x:v){if(f)os<<",";os< ostream& operator<<(ostream& os,const map& v){ os<<"{";bool f=false; for(auto& x:v){if(f)os<<",";os< inline bool chmax(T& a,const T b){bool x=a inline bool chmin(T& a,const T b){bool x=a>b;if(x)a=b;return x;} #ifdef DEBUG void debugg(){cout<void debugg(const T& x,const Args&... args){cout<<" "< using namespace atcoder; using mint=modint998244353; vector> prod(vector>& a,vector>& b){ vector> res(a.size(),vector(b[0].size())); ll i,j,k; rep(i,a.size())rep(j,b.size())rep(k,b[0].size()){ res[i][k]+=a[i][j]*b[j][k]; } return res; } vector> pow(vector> v,ll K){ vector> res(v.size(),vector(v.size())); ll i; rep(i,v.size())res[i][i]=1; if(K&1)res=move(prod(res,v)); while(K){ K>>=1; v=move(prod(v,v)); if(K&1)res=move(prod(res,v)); } return res; } mint p,q; ll S,T,K; int main(){ startupcpp(); ll i,j; cin>>i>>j>>S; p=mint(i)/j; cin>>i>>j>>T>>K; q=mint(i)/j; vector> A(S+T+1,vector(S+T+1,0)); A[0][0]=A[S+T][S+T]=1; auto B=A; rep1(i,S+T){ A[i][i]=1-p; A[S+T][S+T-i]=A[S+T][S+T+1-i]*p; B[i][i]=1-q; B[0][i]=B[0][i-1]*q; } rep1(i,S+T){ for(j=i;j+10;--j)A[i][j-1]=A[i][j]*p; } auto C=move(prod(A,B)); vector> first(S+T+1,vector(1,0)); first[S][0]=1; auto E=move(pow(C,K)); auto D=prod(E,first); print(D[0][0].val()); print(D[S+T][0].val()); }