import sys

input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(max(1000, 10**9))

write = lambda x: sys.stdout.write(x+"\n")





p = int(eval(input()))

a = list(map(int, input().split()))



### 素数の逆元とCombination



M = p

N = 10**4 # 必要なテーブルサイズ



g1 = [None] * (N+1) # 元テーブル

g2 = [None] * (N+1) #逆元テーブル

inverse = [None] * (N+1) #逆元テーブル計算用テーブル

g1[0] = g1[1] = g2[0] = g2[1] = 1

inverse[0], inverse[1] = [0, 1] 



for i in range( 2, N + 1 ):

    g1[i] = ( g1[i-1] * i ) % M 

    inverse[i] = ( -inverse[M % i] * (M//i) ) % M # ai+b==0 mod M <=> i==-b*a^(-1) <=> i^(-1)==-b^(-1)*aより

    g2[i] = (g2[i-1] * inverse[i]) % M 



def cmb(n, r, M):

    if ( r<0 or r>n ):

        return 0

    r = min(r, n-r)

    return (g1[n] * g2[r] * g2[n-r]) % M

ans = [0]*p

for i,num in enumerate(a):

    if num==0:

        continue

    for j in range(p):

        ans[j] += -cmb(p-1,j,M) * pow(-i,p-1-j,M)

        ans[j] %= M

    ans[0] += 1

for i in range(p):

    ans[i] %= M

write(" ".join(map(str, ans)))
import sys

input = lambda : sys.stdin.readline().rstrip()

sys.setrecursionlimit(max(1000, 10**9))

write = lambda x: sys.stdout.write(x+"\n")





p = int(eval(input()))

a = list(map(int, input().split()))



### 素数の逆元とCombination



M = p

N = 10**4 # 必要なテーブルサイズ



g1 = [None] * (N+1) # 元テーブル

g2 = [None] * (N+1) #逆元テーブル

inverse = [None] * (N+1) #逆元テーブル計算用テーブル

g1[0] = g1[1] = g2[0] = g2[1] = 1

inverse[0], inverse[1] = [0, 1] 



for i in range( 2, N + 1 ):

    g1[i] = ( g1[i-1] * i ) % M 

    inverse[i] = ( -inverse[M % i] * (M//i) ) % M # ai+b==0 mod M <=> i==-b*a^(-1) <=> i^(-1)==-b^(-1)*aより

    g2[i] = (g2[i-1] * inverse[i]) % M 



def cmb(n, r, M):

    if ( r<0 or r>n ):

        return 0

    r = min(r, n-r)

    return (g1[n] * g2[r] * g2[n-r]) % M

ans = [0]*p

for i,num in enumerate(a):

    if num==0:

        continue

    val = 1

    for j in reversed(list(range(p))):

        ans[j] += -cmb(p-1,j,M) * val #pow(-i,p-1-j,M)

#         ans[j] += -cmb(p-1,j,M) * pow(-i,p-1-j,M)

        ans[j] %= M

        val *= -i

        val %= M

    ans[0] += 1

for i in range(p):

    ans[i] %= M

write(" ".join(map(str, ans)))
import sys

input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
p = int(eval(input()))
a = list(map(int, input().split()))
### 素数の逆元とCombination
M = p
N = 10**4  # 必要なテーブルサイズ
g1 = [None] * (N + 1)  # 元テーブル
g2 = [None] * (N + 1)  # 逆元テーブル
inverse = [None] * (N + 1)  # 逆元テーブル計算用テーブル
g1[0] = g1[1] = g2[0] = g2[1] = 1
inverse[0], inverse[1] = [0, 1]
for i in range(2, N + 1):
    g1[i] = (g1[i - 1] * i) % M
    inverse[i] = (
        -inverse[M % i] * (M // i)
    ) % M  # ai+b==0 mod M <=> i==-b*a^(-1) <=> i^(-1)==-b^(-1)*aより
    g2[i] = (g2[i - 1] * inverse[i]) % M


def cmb(n, r, M):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return (g1[n] * g2[r] * g2[n - r]) % M


ans = [0] * p
for i, num in enumerate(a):
    if num == 0:
        continue
    for j in range(p):
        ans[j] += -cmb(p - 1, j, M) * pow(-i, p - 1 - j, M)
        ans[j] %= M
    ans[0] += 1
for i in range(p):
    ans[i] %= M
write(" ".join(map(str, ans)))

import sys

input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x + "\n")
p = int(eval(input()))
a = list(map(int, input().split()))
### 素数の逆元とCombination
M = p
N = 10**4  # 必要なテーブルサイズ
g1 = [None] * (N + 1)  # 元テーブル
g2 = [None] * (N + 1)  # 逆元テーブル
inverse = [None] * (N + 1)  # 逆元テーブル計算用テーブル
g1[0] = g1[1] = g2[0] = g2[1] = 1
inverse[0], inverse[1] = [0, 1]
for i in range(2, N + 1):
    g1[i] = (g1[i - 1] * i) % M
    inverse[i] = (
        -inverse[M % i] * (M // i)
    ) % M  # ai+b==0 mod M <=> i==-b*a^(-1) <=> i^(-1)==-b^(-1)*aより
    g2[i] = (g2[i - 1] * inverse[i]) % M


def cmb(n, r, M):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return (g1[n] * g2[r] * g2[n - r]) % M


ans = [0] * p
for i, num in enumerate(a):
    if num == 0:
        continue
    val = 1
    for j in reversed(list(range(p))):
        ans[j] += -cmb(p - 1, j, M) * val  # pow(-i,p-1-j,M)
        #         ans[j] += -cmb(p-1,j,M) * pow(-i,p-1-j,M)
        ans[j] %= M
        val *= -i
        val %= M
    ans[0] += 1
for i in range(p):
    ans[i] %= M
write(" ".join(map(str, ans)))

-    for j in range(p): -        ans[j] += -cmb(p - 1, j, M) * pow(-i, p - 1 - j, M) +    val = 1 +    for j in reversed(list(range(p))): +        ans[j] += -cmb(p - 1, j, M) * val  # pow(-i,p-1-j,M) +        #         ans[j] += -cmb(p-1,j,M) * pow(-i,p-1-j,M) +        val *= -i +        val %= M