P1916 Hermite Multipoint Evaluation / Multipoint Taylor Expansion

Description

Given a polynomial $F(x)=\displaystyle \sum_{i=0}^{n-1}f_ix^i$ of degree less than $n$, and $m$ pairs $(a_i,k_i)$, satisfying $\displaystyle \sum_{i=1}^m k_i=n$. For each pair $(a_i,k_i)$, find $F^{(j)}(a_i)$, $\forall\, 0\le j< k_i$, with the answers taken modulo $998244353$. Here $F^{(i)}(x)$ denotes the $i$-th derivative of $F(x)$.

Input Format

The first line contains two positive integers $n,m$. The second line contains $n$ integers, namely $f_0,f_1,\cdots ,f_{n-1}$ in order. Each of the next $m$ lines represents the values of $a_i,k_i$ on the $i$-th line.

Output Format

Output $m$ lines. The $i$-th line contains $k_i$ numbers, representing $F(a_i),F'(a_i),F^{(2)}(a_i),\cdots ,F^{(k_i-1)}(a_i)$ in order. All answers are taken modulo $998244353$.

Explanation/Hint

For all testdata, $1\le m\le n\le 64000$, $0\le f_i,a_i