Given an integer $$$k$$$ and a polynomial $$$\operatorname{p}$$$.
We call polynomials $$$\operatorname{p}$$$ and $$$\operatorname{q}$$$ different modulo $$$k$$$ iff there exists some $$$x$$$ such that: $$$\operatorname{p}(x) \not= \operatorname{q}(x) \mod k$$$.
Output the number of different polynomials modulo $$$k$$$ in $$$\{x,\operatorname{p}(x),\operatorname{p}(\operatorname{p}(x)),\operatorname{p}(\operatorname{p}(\operatorname{p}(x))), \dots\}$$$.
The first line contains one integer $$$t$$$ ($$$1 \leq t \leq 2 \cdot 10^3$$$), the number of tests.
Each test consists of two lines. The first line contains two integers $$$d, k$$$ ($$$0 \leq d \leq 10^{4}$$$, $$$1 \leq k \leq 10^{4}$$$), the degree of the polynomial and the modulo. The second line contains $$$d+1$$$ integers $$$a_0, \dots, a_d$$$ ($$$-10^9 \leq a_i \leq 10^9$$$), the coefficients of the polynomial: $$$$$$\operatorname{p}(x) = \sum_{i=0}^d a_i \cdot x^i$$$$$$
It is guaranteed that the sum of $$$d$$$ as well as the sum of $$$k$$$ over all testcases does not exceed $$$2 \cdot 10^{4}$$$.
Output the size of the set. As the answer may be large, output it modulo $$$998\,244\,353$$$.
22 4-2 0 25 62 8 -1 -1 -2 8
32
| Name |
|---|


