CF BUDDY
← Problems·

1265E · Beautiful Mirrors

2100 · data structures, dp, math

Problem: Creatnx has nn mirrors, numbered from 11 to nn. Every day, Creatnx asks exactly one mirror "Am I beautiful?". The ii-th mirror will tell Creatnx that he is beautiful with probability pi100\frac{p_i}{100} for all 1in1 \le i \le n.

Creatnx asks the mirrors one by one, starting from the 11-st mirror. Every day, if he asks ii-th mirror, there are two possibilities:

  • The ii-th mirror tells Creatnx that he is beautiful. In this case, if i=ni = n Creatnx will stop and become happy, otherwise he will continue asking the i+1i+1-th mirror next day;
  • In the other case, Creatnx will feel upset. The next day, Creatnx will start asking from the 11-st mirror again.

You need to calculate the expected number of days until Creatnx becomes happy.

This number should be found by modulo 998244353998244353. Formally, let M=998244353M = 998244353. It can be shown that the answer can be expressed as an irreducible fraction pq\frac{p}{q}, where pp and qq are integers and q≢0(modM)q \not \equiv 0 \pmod{M}. Output the integer equal to pq1modMp \cdot q^{-1} \bmod M. In other words, output such an integer xx that 0x<M0 \le x < M and xqp(modM)x \cdot q \equiv p \pmod{M}.

Input Format: The first line contains one integer nn (1n21051\le n\le 2\cdot 10^5) — the number of mirrors.

The second line contains nn integers p1,p2,,pnp_1, p_2, \ldots, p_n (1pi1001 \leq p_i \leq 100).

Output Format: Print the answer modulo 998244353998244353 in a single line.

Note: In the first test, there is only one mirror and it tells, that Creatnx is beautiful with probability 12\frac{1}{2}. So, the expected number of days until Creatnx becomes happy is 22.

Sample Cases

Case 1

Input

1
50

Output

2

Case 2

Input

3
10 20 50

Output

112

Similar problems

00:00:00
Loading editor…
Welcome! I'm your coding tutor for this problem. Use the chips below to reveal stored hints or get AI feedback on your code. I'll guide you step by step — never giving away the solution.

Sign in to unlock AI tutor feedback