You are given N+1 distinct positive integers A1,A2,......,AN+1 and a positive integer M. A polynomial of degree N is defined as follows:
f(x)=P1xN+P2xN−1+……..+PNx+PN+1
such that following conditions hold true:
f(Ai)=AN+1i ∀i∈[1,N+1]
P1>0
P1,P2,.....,PN+1 are integers
A new polynomial is defined as
S(x)=X1xN+X2xN−1+……..+XNx+XN+1
Such that Xi=|Pi|%M ∀i∈[1,N+1] and X1,X2,.......,XN+1 are integers.
Evaluate S(0)%M,S(1)%M,…….S(M−1)%M .
Input format
Output format
Constraints
1≤N,M,Ai≤105
M is prime
Subtasks
Required polynomial F(x) is 6x2−11x+6 and hence S(x) is 6x2+11x+6. Hence S(0)%M=6, S(1)%M=23%13=10 and so on.