#P4726. Exponential of a Polynomial
Exponential of a Polynomial
Exponential of a Polynomial
Given a polynomial (A(x)=\sum_{i=0}^{n-1}A_i x^i) of degree (n-1) with coefficients modulo (998244353) and satisfying (A(0)=0), compute the polynomial (B(x)) modulo (x^n) such that
[B(x)\equiv \exp(A(x))\equiv \sum_{k \ge 0} \frac{A(x)^k}{k!} \pmod{x^n}.]
The answer should be output as (n) space-separated integers representing the coefficients (B_0, B_1, \ldots, B_{n-1}<br>All operations are performed modulo (998244353).
inputFormat
The first line contains a single integer (n) denoting the number of coefficients (i.e. the polynomial degree is (n-1)).
The second line contains (n) space-separated integers (A_0, A_1, \ldots, A_{n-1}) representing the coefficients of (A(x)). It is guaranteed that (A_0 = 0) so that the formal power series exponential is well defined.
outputFormat
Output a single line containing (n) space-separated integers (B_0, B_1, \ldots, B_{n-1}), where (B(x)=\sum_{i=0}^{n-1}B_i x^i) is the truncated exponential of (A(x)) modulo (x^n) and all operations are taken modulo (998244353).
sample
3
0 1 0
1 1 499122177