#P5393. Falling Factorial to Ordinary Polynomial

    ID: 18625 Type: Default 1000ms 256MiB

Falling Factorial to Ordinary Polynomial

Falling Factorial to Ordinary Polynomial

You are given a falling factorial polynomial

\(F(x)=\sum_{i=0}^{n-1} a_i\, x^{\underline{i}}\), where
\(x^{\underline{i}} = x(x-1)\cdots (x-i+1)\) for \(i\ge1\) and \(x^{\underline{0}}=1\).

Your task is to convert it to an ordinary polynomial

\(G(x)=\sum_{i=0}^{n-1} b_i x^i\) such that \(G(x)=F(x)\) identically.

All operations are performed modulo \(998244353\).

Hint: It is known that the falling factorial can be expressed in the standard basis using Stirling numbers of the first kind:

[ x^{\underline{i}} = \sum_{j=0}^{i} (-1)^{i-j}, s(i,j), x^j, ]

where \(s(i,j)\) are the (signed) Stirling numbers of the first kind. Therefore, the coefficient \(b_j\) is computed as

[ b_j = \sum_{i=j}^{n-1} a_i, (-1)^{i-j}, s(i,j) \pmod{998244353}. ]

</p>

inputFormat

The first line contains a single integer \(n\) (the number of coefficients).
The second line contains \(n\) integers \(a_0, a_1, \ldots, a_{n-1}\) separated by spaces.

outputFormat

Output \(n\) integers \(b_0, b_1, \ldots, b_{n-1}\) separated by spaces, which are the coefficients of the ordinary polynomial \(G(x)=\sum_{i=0}^{n-1}b_ix^i\).

sample

1
5
5