Hide

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,,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 h1,h2,,hn 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 2105.

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 998244353.

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
Hide

Please log in to submit a solution to this problem

Log in