#include using namespace std; //* ATCODER #include using namespace atcoder; typedef modint998244353 mint; //*/ /* BOOST MULTIPRECISION #include using namespace boost::multiprecision; //*/ typedef long long ll; #define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++) #define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--) template bool chmin(T &a, const T &b) { if (a <= b) return false; a = b; return true; } template bool chmax(T &a, const T &b) { if (a >= b) return false; a = b; return true; } template T max(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]); return ret; } template T min(vector &a){ assert(!a.empty()); T ret = a[0]; for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]); return ret; } template T sum(vector &a){ T ret = 0; for (int i=0; i<(int)a.size(); i++) ret += a[i]; return ret; } vector poly_inv(vector &a, int M = -314159265){ if (M == -314159265) M = (int)a.size(); else if (M <= 0) return {}; int n = a.size(); mint r = a[0].pow((ll)(mint::mod())-2); int m = 1; vector res = {r}; while (m < M){ vector f = a; f.resize(2 * m); vector g = res; g.resize(2 * m); internal::butterfly(f); internal::butterfly(g); for (int i=0; i<2*m; i++){ f[i] = f[i] * g[i]; } internal::butterfly_inv(f); for (int i=0; i> p1 >> p2 >> q1 >> q2 >> t; mint p = mint(p1) / mint(p2); mint q = mint(q1) / mint(q2); vector C(t+1); rep(i,0,t+1){ C[i] = p * mint(q).pow(ll(i)*(i+1)/2); } vector D(t+1); D[0] = 1; rep(i,0,t){ D[i+1] = - C[i]; } vector B = convolution(C, poly_inv(D)); B.resize(t); mint ans = mint(q).pow(ll(t)*(t+1)/2); rep(i,0,t){ ans += B[i] * mint(q).pow(ll(t-i)*(t-i-1)/2); } cout << ans.val() << '\n'; }