#include using namespace std; #include "atcoder/convolution.hpp" #include "atcoder/modint.hpp" using mint = atcoder::modint998244353; vector inv(vector &F) { int n = F.size(); vector G = {mint(1) / F[0]}; int l = 1; while (l < n) { vector tmp = G; for (int i = 0; i < l; i++) { tmp[i] *= 2; } l <<= 1; G = atcoder::convolution(G, G); vector tmp2; if (n >= l) { tmp2 = atcoder::convolution(vector({F.begin(), F.begin() + l}), G); } else { tmp2 = atcoder::convolution(F, G); } G.assign(l, 0); for (int i = 0; i < l; i++) { if (i < tmp.size()) G[i] += tmp[i]; if (i < tmp2.size()) G[i] -= tmp2[i]; } } G.resize(n); return G; } int main() { long long p1, p2, q1, q2, T; cin >> p1 >> p2 >> q1 >> q2 >> T; mint p = mint(p1) / p2; mint q = mint(q1) / q2; vector powQ(T + 1, 1); for (int i = 1; i <= T; i++) { powQ[i] = powQ[i - 1] * q; } if (p == 0) { mint ans = 1; for (int i = 1; i <= T; i++) { ans *= powQ[i]; } cout << ans.val() << endl; return 0; } vector F(T + 2, 0); mint alive = 1; for (int i = 1; i < T + 2; i++) { F[i] = alive * p; alive *= powQ[i]; } F[0] = 1; for (int i = 1; i < T + 2; i++) { F[i] = -F[i]; } auto G = inv(F); mint ans = G[T + 1] / p; cout << ans.val() << endl; }