Problem H
Dice Results
Languages
en
is
You are given a set of dice which will be thrown. Each die has some number of sides $H$ and all sides are equally likely to be the result when the die is thrown. If a die has $H$ sides the numbers on the sides are $1, 2, \dots , H$. Find the probability distribution of the sum of all thrown dice.
Input
The first line of input contains a single integer $n$, the number of dice. On the next line there are $n$ integers $h_1, h_2, \dots , h_n$ which give the number of sides of the $n$ dice. You may assume that the highest possible result of throwing all dice is at most $2 \cdot 10^5$.
Output
For each result from $1$ to the maximum roll, print the number of ways to achieve that result. Since this number might be very large, print it modulo $998\, 244\, 353$.
Sample Input 1 | Sample Output 1 |
---|---|
2 4 5 |
0 1 2 3 4 4 3 2 1 |
Sample Input 2 | Sample Output 2 |
---|---|
4 1 1 4 8 |
0 0 0 1 2 3 4 4 4 4 4 3 2 1 |