#P8229. Magic Strawberries

    ID: 21408 Type: Default 1000ms 256MiB

Magic Strawberries

Magic Strawberries

Illy discovered a magic number \(K\), a magic basket full of strawberries, and a magic coin. She observed that when tossing the coin, it lands heads with probability \(P\). She then tossed the coin \(n\) times. On each toss, if the coin lands heads, the number of strawberries in the basket multiplies by \(K\); otherwise, she eats all the strawberries in the basket, and the basket magically produces exactly one new strawberry.

Assume that initially the basket contains exactly one strawberry. Your task is to determine the expected total number of strawberries eaten after \(n\) tosses. Since the answer can be very large, output it modulo \(998244353\).

Note: The probability \(P\) is given as an integer percentage. That is, if the input gives \(P=50\), then the probability of heads is \(\frac{50}{100}=0.5\).

inputFormat

The input consists of a single line containing three integers (n), (K), and (P) separated by spaces. Here, (n) is the number of coin tosses, (K) is the magic multiplier, and (P) is the percentage probability (an integer between 0 and 100) that the coin lands heads.

outputFormat

Output a single integer: the expected number of strawberries eaten after (n) tosses, computed modulo (998244353).

sample

1 2 50
499122177