H. Tree Scoring
time limit per test
8 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Given a rooted tree on $$$n$$$ vertices with values $$$a_1, \dots, a_n$$$ written on the vertices, we define the score of a vertex as the product of $$$a_u$$$ for all vertices $$$u$$$ in the subtree of $$$v$$$.

However, you've lost the tree and just the values remain. All you remember is the following,

  • the tree had $$$n$$$ vertices labelled from $$$1$$$ to $$$n$$$,
  • the tree was rooted at the vertex with label $$$1$$$,
  • for every non-root vertex, its parent had a strictly smaller label.

Even though there are $$$(n - 1)!$$$ such trees possible, you try to compute the score of each vertex using just this information.

Output the expected score, modulo $$$998\,244\,353$$$, of each vertex on uniformly randomly sampling a tree satisfying the above constraints.

Formally, let $$$M = 998\,244\,353$$$. It can be shown that the expected score can be expressed as an irreducible fraction $$$\frac{p}{q}$$$, where $$$p$$$ and $$$q$$$ are integers and $$$q \not \equiv 0 \pmod{M}$$$. Output the integer equal to $$$p \cdot q^{-1} \bmod M$$$. In other words, output an integer $$$x$$$ such that $$$0 \le x \lt M$$$ and $$$x \cdot q \equiv p \pmod{M}$$$.

Input

The first line contains an integer $$$n$$$ ($$$2 \le n \le 2 \times 10^5$$$), the size of the lost tree.

The second line contains $$$n$$$ space-separated integers $$$a_1, \dots, a_n$$$ ($$$0 \le a_i \lt 998\,244\,353$$$), $$$a_i$$$ being the value written on the $$$i$$$-th vertex.

Output

Output $$$n$$$ integers, the expected score of the vertices $$$1, 2, \dots, n$$$ in that order.

Examples
Input
2
4 2
Output
8 2
Input
4
1 2 3 4
Output
24 11 6 4
Note

In sample 2, the following 6 trees are possible

Going from left to right, the scores in each case are as follows
  1. $$$[24, 24, 12, 4]$$$
  2. $$$[24, 24, 3, 4]$$$
  3. $$$[24, 6, 3, 4]$$$
  4. $$$[24, 2, 12, 4]$$$
  5. $$$[24, 8, 3, 4]$$$
  6. $$$[24, 2, 3, 4]$$$
Summing up and dividing by $$$6$$$ we get the expected scores of $$$[24, 11, 6, 4]$$$.