| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 22 | 18 | 17 | 80.952% |
For each $i = 1, 2, \dots, N,ドル there are $A_i$ balls with $i$ written on them. These are put into a box and mixed up. The string variable $s$ consists of initially $N$ “0”s. Balls are taken out of the box one by one (uniformly at random and independently). When a ball with $i$ written on it is drawn, the $i$-th character of $s$ is changed to “1” (it remains unchanged if it was already “1”). Find the probability, modulo 998ドル,244円,353円,ドル of having a point during this process that $s$ contains “101” as a contiguous substring.
The input consists of a single test case of the following format.
$N$
$A_1$ $A_2$ $\dots$ $A_N$
The first line consists of an integer $N$ between 1ドル$ and 200ドル,000円,ドル inclusive. The second line consists of $N$ positive integers $A_1, A_2, \dots , A_N$. For each $i$ (1ドル \le i \le N$), $A_i$ represents the number of balls $i$ written. And they satisfy $\sum_{1 \le i \le N}{A_i} < 998,244円,353円$.
Output in a line the probability modulo 998ドル,244円,353円$.
3 1 2 3
465847365
10 3 1 4 1 5 9 2 6 5 3
488186016