import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)



import numpy as np

from numpy.fft import rfft, irfft

import itertools



P = int(eval(input()))

A = [int(x) for x in input().split()]



fft_len = 6144

def fft_convolve(A,B):

    C = irfft(rfft(A,fft_len) * rfft(B,fft_len))

    C = (C + .5).astype(np.int64)

    C[:P] += C[P:P+P]

    return C[:P] % P

  

one = np.array([1], dtype=np.int64)

arr = [np.array([(-x)%P,1],dtype=np.int64) for x in range(P)]

L = [one] + list(itertools.accumulate(arr[:-1],lambda a,b: np.convolve(a,b) % P))

R = ([one] + list(itertools.accumulate(arr[1:][::-1],lambda a,b: np.convolve(a,b) % P)))[::-1]

X = [fft_convolve(A,B) % P for A,B in zip(L,R)]



f = np.zeros(P,dtype=np.int64)

for a,x in zip(A,X):

    if a == 1:

        f -= x



f %= P

print((*f))

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



import numpy as np



p = int(readline())

A = np.array(read().split(),np.int64)



"""

・f_i(x) = 1 - (x-a)^{p-1} とすると、f_i(x)はx=iのみで1をとる：これは二項係数とべき乗

・sum a_if_i が答

"""



power = np.ones((p,p),dtype=np.int64)

x = np.arange(p,dtype=np.int64)

for n in range(1,p):

    power[:,n] = power[:,n-1] * x % p



def cumprod(arr,MOD):

    L = len(arr); Lsq = int(L**.5+1)

    arr = np.resize(arr,Lsq**2).reshape(Lsq,Lsq)

    for n in range(1,Lsq):

        arr[:,n] *= arr[:,n-1]; arr[:,n] %= MOD

    for n in range(1,Lsq):

        arr[n] *= arr[n-1,-1]; arr[n] %= MOD

    return arr.ravel()[:L]



def make_fact(U,MOD):

    x = np.arange(U,dtype=np.int64); x[0] = 1

    fact = cumprod(x,MOD)

    x = np.arange(U,0,-1,dtype=np.int64); x[0] = pow(int(fact[-1]),MOD-2,MOD)

    fact_inv = cumprod(x,MOD)[::-1]

    return fact,fact_inv



fact, fact_inv = make_fact(p,p)



# p-1 C i

comb = fact[p-1] * fact_inv[0:p] % p * fact_inv[p-1::-1] % p



comb[::2] *= (-1)



F = power * comb[:,None] % p

F[:,-1] += 1



answer = ((F * A[:,None]).sum(axis=0) % p)[::-1]



print((' '.join(answer.astype(str))))
import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
import numpy as np
from numpy.fft import rfft, irfft
import itertools

P = int(eval(input()))
A = [int(x) for x in input().split()]
fft_len = 6144


def fft_convolve(A, B):
    C = irfft(rfft(A, fft_len) * rfft(B, fft_len))
    C = (C + 0.5).astype(np.int64)
    C[:P] += C[P : P + P]
    return C[:P] % P


one = np.array([1], dtype=np.int64)
arr = [np.array([(-x) % P, 1], dtype=np.int64) for x in range(P)]
L = [one] + list(itertools.accumulate(arr[:-1], lambda a, b: np.convolve(a, b) % P))
R = (
    [one]
    + list(itertools.accumulate(arr[1:][::-1], lambda a, b: np.convolve(a, b) % P))
)[::-1]
X = [fft_convolve(A, B) % P for A, B in zip(L, R)]
f = np.zeros(P, dtype=np.int64)
for a, x in zip(A, X):
    if a == 1:
        f -= x
f %= P
print((*f))

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

p = int(readline())
A = np.array(read().split(), np.int64)
"""
・f_i(x) = 1 - (x-a)^{p-1} とすると、f_i(x)はx=iのみで1をとる：これは二項係数とべき乗
・sum a_if_i が答
"""
power = np.ones((p, p), dtype=np.int64)
x = np.arange(p, dtype=np.int64)
for n in range(1, p):
    power[:, n] = power[:, n - 1] * x % p


def cumprod(arr, MOD):
    L = len(arr)
    Lsq = int(L**0.5 + 1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n - 1]
        arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n - 1, -1]
        arr[n] %= MOD
    return arr.ravel()[:L]


def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64)
    x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64)
    x[0] = pow(int(fact[-1]), MOD - 2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv


fact, fact_inv = make_fact(p, p)
# p-1 C i
comb = fact[p - 1] * fact_inv[0:p] % p * fact_inv[p - 1 :: -1] % p
comb[::2] *= -1
F = power * comb[:, None] % p
F[:, -1] += 1
answer = ((F * A[:, None]).sum(axis=0) % p)[::-1]
print((" ".join(answer.astype(str))))

-input = sys.stdin.readline -sys.setrecursionlimit(10**7) +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines -from numpy.fft import rfft, irfft -import itertools -P = int(eval(input())) -A = [int(x) for x in input().split()] -fft_len = 6144 +p = int(readline()) +A = np.array(read().split(), np.int64) +""" +・f_i(x) = 1 - (x-a)^{p-1} とすると、f_i(x)はx=iのみで1をとる：これは二項係数とべき乗 +・sum a_if_i が答 +""" +power = np.ones((p, p), dtype=np.int64) +x = np.arange(p, dtype=np.int64) +for n in range(1, p): +    power[:, n] = power[:, n - 1] * x % p -def fft_convolve(A, B): -    C = irfft(rfft(A, fft_len) * rfft(B, fft_len)) -    C = (C + 0.5).astype(np.int64) -    C[:P] += C[P : P + P] -    return C[:P] % P +def cumprod(arr, MOD): +    L = len(arr) +    Lsq = int(L**0.5 + 1) +    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq) +    for n in range(1, Lsq): +        arr[:, n] *= arr[:, n - 1] +        arr[:, n] %= MOD +    for n in range(1, Lsq): +        arr[n] *= arr[n - 1, -1] +        arr[n] %= MOD +    return arr.ravel()[:L] -one = np.array([1], dtype=np.int64) -arr = [np.array([(-x) % P, 1], dtype=np.int64) for x in range(P)] -L = [one] + list(itertools.accumulate(arr[:-1], lambda a, b: np.convolve(a, b) % P)) -R = ( -    [one] -    + list(itertools.accumulate(arr[1:][::-1], lambda a, b: np.convolve(a, b) % P)) -)[::-1] -X = [fft_convolve(A, B) % P for A, B in zip(L, R)] -f = np.zeros(P, dtype=np.int64) -for a, x in zip(A, X): -    if a == 1: -        f -= x -f %= P -print((*f)) +def make_fact(U, MOD): +    x = np.arange(U, dtype=np.int64) +    x[0] = 1 +    fact = cumprod(x, MOD) +    x = np.arange(U, 0, -1, dtype=np.int64) +    x[0] = pow(int(fact[-1]), MOD - 2, MOD) +    fact_inv = cumprod(x, MOD)[::-1] +    return fact, fact_inv + + +fact, fact_inv = make_fact(p, p) +# p-1 C i +comb = fact[p - 1] * fact_inv[0:p] % p * fact_inv[p - 1 :: -1] % p +comb[::2] *= -1 +F = power * comb[:, None] % p +F[:, -1] += 1 +answer = ((F * A[:, None]).sum(axis=0) % p)[::-1] +print((" ".join(answer.astype(str))))