#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; void fast_io() { ios::sync_with_stdio(false); std::cin.tie(nullptr); } vector f, g, h; int n; void calc(int l1, int r1, int l2, int r2) { while (h.size() < r1 + r2 - 1) { h.push_back(0); } vector f1, f2; for (int i = l1; i < r1; i++) { f1.push_back(f[i]); } for (int i = l2; i < r2; i++) { f2.push_back(g[i]); } vector fg = convolution(f1, f2); for (int i = 0; i < fg.size(); i++) { h[i + l1 + l2] += fg[i]; } } mint append(mint a, mint b) { f.push_back(a); g.push_back(b); n++; int m = (n + 1) & -(n + 1); int s = 0; if (m <= n) { int add = 1; while (add <= m) { calc(n - add, n, s, s + add); calc(s, s + add, n - add, n); s += add; add <<= 1; } } else { int add = 1; while (add < (m >> 1)) { calc(n - add, n, s, s + add); calc(s, s + add, n - add, n); s += add; add <<= 1; } calc(n - add, n, s, s + add); } return h[n - 1]; } int main() { fast_io(); int pp1, pp2, qq1, qq2, t; cin >> pp1 >> pp2 >> qq1 >> qq2 >> t; mint p = mint(pp1) / pp2, q = mint(qq1) / qq2; vector birth(t + 2), remain(t + 2); birth[0] = 1; for (int i = 1; i <= t + 1; i++) { remain[i] = append(birth[i - 1], q.pow(i * (i - 1) / 2)); birth[i] = remain[i] * p; } cout << remain[t + 1].val() << endl; }