#P7461. [2017年杭电多校]RXD and functions

[2017年杭电多校]RXD and functions

RXD and functions

Problem Description

RXD has a polynomial function f(x)f(x), f(x)=i=0ncixif(x) = \sum_{i = 0}^{n}{c_ix^i} RXD has a transformation of function Tr(f,a)Tr(f, a), it returns another function gg, which has a property that g(x)=f(xa)g(x) = f(x - a). Given a1,a2,a3,,ama_1, a_2, a_3, \dots , a_m, RXD generates a polynomial function sequence gig_i, in which g0=fg_0 = f and gi=Tr(gi1,ai)g_i = Tr(g_{i - 1}, a_i) RXD wants you to find gmg_m, in the form of i=0mbixi\sum_{i = 0}^{m}{b_ix^i} You need to output bib_i module 998244353. n105n\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 nn, which means degF\deg F. The next line consists of n+1n + 1 intergers ci,0ci<998244353c_i, 0 \leq c_i < 998244353, which means the coefficient of the polynomial. The next line contains an integer mm, which means the length of aa. The next line contains mm integers, the i - th integer is aia_i. There are 11 test cases. 0<=ai<9982443530<=ai<998244353 m105\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

(x1)2=x22x+1(x - 1) ^ 2 = x^2 - 2x + 1

Source

2017 Multi-University Training Contest - Team 3

https://acm.hdu.edu.cn/showproblem.php?pid=6061