MOD = 998244353i64 def inv(v : Int64) pow(v, MOD - 2) end def pow(v : Int64, p) ret = 1i64 while p > 0 if (p & 1i64) != 0 ret *= v ret %= MOD end v *= v v %= MOD p >>= 1 end ret end p1, p2, q1, q2, t = read_line.split.map(&.to_i) p = p1.to_i64 * inv(p2.to_i64) % MOD q = q1.to_i64 * inv(q2.to_i64) % MOD qs = Array.new(t + 1, 1i64) t.times { |i| qs[i + 1] = qs[i] * q % MOD } dp = Array.new(t + 1) { Array.new(t + 1, -1i64) } dp[0][0] = 1i64 dfs = uninitialized (Int32, Int32) -> Int64 dfs = ->(i : Int32, j : Int32) : Int64 do return dp[i][j] if dp[i][j] != -1 return qs[i] if j == 0 dp[i][j] = qs[i] * p % MOD * dfs.call(0, j - 1) % MOD dp[i][j] += qs[i] * dfs.call(i + 1, j - 1) dp[i][j] %= MOD return dp[i][j] end puts dfs.call(0, t)