#P6667. [清华集训 2016] 如何优雅地求和

[清华集训 2016] 如何优雅地求和

Description

There is a polynomial function f(x)f(x) whose highest power is xmx^m. Define a transformation QQ:

Q(f,n,x)=k=0nf(k)(nk)xk(1x)nkQ(f,n,x)=∑_{k=0}^{n}f(k)\binom nkx^k(1−x)^{n−k}

Now given ff and n,xn, x, compute Q(f,n,x)mod998244353Q(f,n,x)\bmod998244353.

For some reason, the function ff is given in point-value form. That is, m+1m+1 numbers a0,a1,,ama_0,a_1,⋯,a_m are given, and f(x)=axf(x)=a_x. It can be proven that this function is unique.

Input Format

The first line contains three integers n,m,xn, m, x, with meanings as described above.

The second line contains m+1m+1 integers, representing a0,a1,,ama_0,a_1,⋯,a_m.

Output Format

Output one number in one line as the answer, taken modulo 998,244,353998,244,353.

4 1 332748118
0 1
332748119
4 3 12
0 1 8 27
46704

Hint

Explanation for Sample 22

After calculation, f(x)=x3f(x)=x^3.

Constraints

For all testdata, it is guaranteed that 1n1091≤n≤10^9, 1m2×1041≤m≤2×10^4, and 0ai,x<998,244,3530≤a_i,x<998,244,353.

Translated by ChatGPT 5