P28824 [洛谷] 【Template】Divide and Conquer FFT
提高+
题目描述

Problem Background

This problem can also be solved using polynomial inversion.

Problem Description

Given the sequence \( g_{1 \dots n - 1} \), compute the sequence \( f_{0 \dots n - 1} \).

Where \( f_i = \sum_{j=1}^i f_{i-j} g_j \), with the boundary condition \( f_0 = 1 \).

The answer should be taken modulo \( 998244353 \).

Input Format

The first line contains an integer \( n \).

The second line contains \( n-1 \) integers \( g_{1 \dots n - 1} \).

Output Format

A single line containing \( n \) integers, representing \( f_{0 \dots n - 1} \) modulo \( 998244353 \).

Sample Input and Output

Input Sample #1

4
3 1 2

Output Sample #1

1 3 10 35

Input Sample #2

10
2 456 32 13524543 998244352 0 1231 634544 51

Output Sample #2

1 2 460 1864 13738095 55389979 617768468 234028967 673827961 708520894

Notes

\( 2 \leq n \leq 10^5 \), \( 0 \leq g_i < 998244353 \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 3 1 2
样例输出
1 3 10 35