{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eNow it\u0027s time after math class!\u003cbr\u003e\u003cbr\u003eThe teacher taught Baby Volcano what can do with polynomials and how to use polynomials.The teacher said that a polynomial of degree $n$ can be written as $f(x)\u003d\\sum \\limits_{i\u003d0}^{n} a_i x^i$. Also,you can regard it as a function,and replace $x$ with some number $a$ in order to get a special value called $f(a)$\u003cbr\u003e\u003cbr\u003eToday\u0027s math homework is to calculate $f(a)$ of a polynomial of degree $n$,$f(x)$.Because the answer is extremely large,Baby Volcano is only asked to write $f(x) \\bmod p$ on the paper,where $p$ is a prime number.\u003cbr\u003e\u003cbr\u003eBaby Volcano writes number $f(0) \\bmod p,f(1) \\bmod p,\\cdots,f(n) \\bmod p$ on a textbook quickly. After a while,however,he lost $f(x)$ and can\u0027t continue with his homework.\u003cbr\u003e\u003cbr\u003eBaby Volcano want to find $f(x)$,But he is too small to solve it.Baby Volcano needs your help!\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line contains one integer $T(1 \\le T \\le 50)$ stand for the test cases you should solve.\u003cbr\u003e\u003cbr\u003eFor each test cases,the first line contains two integer $n,p(1 \\leq n \u0026lt; p-1,3 \\leq p \\leq 5 \\times 10^5)$.\u003cbr\u003e\u003cbr\u003eThe next line contains $n+1$ integer,the $i$-th stand for $f(i-1)$.\u003cbr\u003e\u003cbr\u003eThe input garantees that $\\sum p \\leq 10^6,p$ is prime,$0 \\leq f(i) \u0026lt; p$."}},{"title":"Output","value":{"format":"HTML","content":"For each test case, you should firstly output \"Case #t: \"(without quotes), where $t$ is the index of this test case.\u003cbr\u003e\u003cbr\u003eIn the next line,you should output a single line contains $n+1$ integer.The $i$-th stands for $a_{i-1} \\bmod p$.\u003cbr\u003e\u003cbr\u003eIt can be proved that there is only one solution if you modulo the coefficient by $p$,so there is and only one acceptable output."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n2 10007\r\n1 4 9\r\n3 10007\r\n1 8 27 64\r\n12 10007\r\n1 1 4 5 1 4 1 9 1 9 8 1 0\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eCase #1:\r\n1 2 1\r\nCase #2:\r\n1 3 3 1\r\nCase #3:\r\n1 8594 9725 4829 7653 7268 9644 5003 6141 3793 9624 5125 2657\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}