RXD and functions

Time Limit: 4000/2000 MS (Java/Others)

Memory Limit: 524288/524288 K (Java/Others)

Description

RXD has a polynomial function $f(x)$, $f(x) = \sum_{i = 0}^{n}{c_ix^i}$
RXD has a transformation of function $Tr(f, a)$, it returns another function $g$, which has a property that $g(x) = f(x - a)$.
Given $a_1, a_2, a_3, \dots , a_m$, RXD generates a polynomial function sequence $g_i$, in which $g_0 = f$ and $g_i = Tr(g_{i - 1}, a_i)$
RXD wants you to find $g_m$, in the form of $\sum_{i = 0}^{m}{b_ix^i}$
You need to output $b_i$ module 998244353.
$n\leq 10^5$

Input

There are several test cases, please keep reading until EOF.
For each test case, the first line consists of 1 integer $n$, which means $\deg F$.
The next line consists of $n + 1$ intergers $c_i, 0 \leq c_i < 998244353$, which means the coefficient of the polynomial.
The next line contains an integer $m$, which means the length of $a$.
The next line contains $m$ integers, the i - th integer is $a_i$.
There are 11 test cases.
$0<=ai<998244353$
$\sum m\leq 10^5$

Output

For each test case, output an polynomial with degree n, which means the answer.

Sample Input

2 0 0 1 1 1

Sample Output

1 998244351 1
Hint
$(x - 1) ^ 2 = x^2 - 2x + 1$

Hint

liuyiding

Source

2017 Multi-University Training Contest - Te

提交代码