atcoder#AGC056E. [AGC056E] Cheese

[AGC056E] Cheese

Score : 16001600 points

Problem Statement

There is a circumference of length NN. On this circumference, a point whose distance from a certain fixed point, measured in the clockwise direction, is xx has the coordinate xx.

For each integer ii (0iN10 \leq i \leq N-1), there is a mouse at coordinate i+0.5i+0.5.

Snuke will throw a piece of cheese N1N-1 times. More specifically, he repeats the following N1N-1 times.

  • Choose an integer yy (0yN10 \leq y \leq N-1) randomly, where y=iy=i is chosen with probability AiA_i percent. This choice is made independently each time.
  • Then, throw cheese from the coordinate yy. The cheese travels in the clockwise direction on the circumference. When the cheese meets a mouse, the following happens.- If the mouse has not eaten cheese:- It eats the cheese with probability 1/21/2. The cheese disappears.
    • It does nothing with probability 1/21/2.
    • If the mouse has already eaten cheese:- It does nothing.
  • If the mouse has not eaten cheese:
  • It eats the cheese with probability 1/21/2. The cheese disappears.
  • It does nothing with probability 1/21/2.
  • If the mouse has already eaten cheese:
  • It does nothing.
  • The cheese keeps traveling on the circumference until eaten by some mouse.

After N1N-1 throws of cheese, there will be exactly one mouse that has never eaten cheese. For each k=0,1,,N1k=0,1,\cdots,N-1, find the probability that the mouse at coordinate k+0.5k+0.5 ends up not eating cheese, modulo 998244353998244353.

How to represent a probability modulo $998244353$

We can prove that each probability in question is always a rational number. Additionally, under the Constraints of this problem, when that number is represented as an irreducible fraction PQ\frac{P}{Q}, we can also prove that Q0(mod998244353)Q \neq 0 \pmod{998244353}. Thus, there is a unique integer RR such that $R \times Q \equiv P \pmod{998244353}, 0 \leq R < 998244353$. Answer with this RR.

Constraints

  • 1N401 \leq N \leq 40
  • 0Ai0 \leq A_i
  • 0iN1Ai=100\sum_{0 \leq i \leq N-1} A_i = 100
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN

A0A_0 A1A_1 \cdots AN1A_{N-1}

Output

Print the answers for k=0,1,,N1k=0,1,\cdots,N-1 in one line, with spaces in between.

2
0 100
665496236 332748118

y=1y=1 is always chosen. When throwing cheese from this point, the following happens.

  • With probability 1/21/2, the mouse at coordinate 1.51.5 eats it.
  • With probability 1/41/4, the mouse at coordinate 0.50.5 eats it.
  • With probability 1/81/8, the mouse at coordinate 1.51.5 eats it.
  • With probability 1/161/16, the mouse at coordinate 0.50.5 eats it.
  • \vdots

In the end, the mice at coordinates 0.50.5 and 1.51.5 eat this cheese with probabilities 1/31/3 and 2/32/3, respectively.

Therefore, they end up not eating cheese with probabilities 2/32/3 and 1/31/3, respectively.

2
50 50
499122177 499122177
10
1 2 3 4 5 6 7 8 9 55
333507001 91405664 419217284 757959653 974851434 806873643 112668439 378659755 979030842 137048051