import sys

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

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

def resolve():

    # preparation

    p=int(eval(input()))

    invfact=[0]*p

    invfact[p-1]=p-1 # Wilson's theorem

    for i in range(2,p):

        invfact[p-i]=invfact[p-i+1]*(p-i+1)%p



    # initialize

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

    ans=[0]*p

    ans[0]=A[0]

    r=[0]*(p+1) # for use of r[-1]=0

    r[0]=1



    # iterate

    for k in range(1,p):

        newr=[0]*(p+1) # newr(x)=(x-(k-1))r(x)

        v=0 # v=f[k-1](k)

        power=1

        for i in range(p):

            v+=ans[i]*power%p

            power*=k

            power%=p

            newr[i]=(r[i-1]-(k-1)*r[i])%p

        r=newr

        for i in range(p):

            ans[i]+=(A[k]-v)*invfact[k]*r[i]

            ans[i]%=p

    print((*ans))

resolve()
import sys

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

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

def resolve():

    p=int(eval(input()))

    r=[0]*(p+1)

    r[1]=-1; r[p]=1

    ans=[0]*p

    for i,a in enumerate(map(int,input().split())):

        if(not a): continue

        u=[0]*(p+1) # u(x)=r(x)/(x-i)

        for k in range(p-1,-1,-1):

            u[k]=(r[k+1]+i*u[k+1])%p

            ans[k]-=u[k]

            ans[k]%=p

    print((*ans))

resolve()
import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    # preparation
    p = int(eval(input()))
    invfact = [0] * p
    invfact[p - 1] = p - 1  # Wilson's theorem
    for i in range(2, p):
        invfact[p - i] = invfact[p - i + 1] * (p - i + 1) % p
    # initialize
    A = list(map(int, input().split()))
    ans = [0] * p
    ans[0] = A[0]
    r = [0] * (p + 1)  # for use of r[-1]=0
    r[0] = 1
    # iterate
    for k in range(1, p):
        newr = [0] * (p + 1)  # newr(x)=(x-(k-1))r(x)
        v = 0  # v=f[k-1](k)
        power = 1
        for i in range(p):
            v += ans[i] * power % p
            power *= k
            power %= p
            newr[i] = (r[i - 1] - (k - 1) * r[i]) % p
        r = newr
        for i in range(p):
            ans[i] += (A[k] - v) * invfact[k] * r[i]
            ans[i] %= p
    print((*ans))


resolve()

import sys

sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
input = lambda: sys.stdin.readline().rstrip()


def resolve():
    p = int(eval(input()))
    r = [0] * (p + 1)
    r[1] = -1
    r[p] = 1
    ans = [0] * p
    for i, a in enumerate(map(int, input().split())):
        if not a:
            continue
        u = [0] * (p + 1)  # u(x)=r(x)/(x-i)
        for k in range(p - 1, -1, -1):
            u[k] = (r[k + 1] + i * u[k + 1]) % p
            ans[k] -= u[k]
            ans[k] %= p
    print((*ans))


resolve()

-    # preparation -    invfact = [0] * p -    invfact[p - 1] = p - 1  # Wilson's theorem -    for i in range(2, p): -        invfact[p - i] = invfact[p - i + 1] * (p - i + 1) % p -    # initialize -    A = list(map(int, input().split())) +    r = [0] * (p + 1) +    r[1] = -1 +    r[p] = 1 -    ans[0] = A[0] -    r = [0] * (p + 1)  # for use of r[-1]=0 -    r[0] = 1 -    # iterate -    for k in range(1, p): -        newr = [0] * (p + 1)  # newr(x)=(x-(k-1))r(x) -        v = 0  # v=f[k-1](k) -        power = 1 -        for i in range(p): -            v += ans[i] * power % p -            power *= k -            power %= p -            newr[i] = (r[i - 1] - (k - 1) * r[i]) % p -        r = newr -        for i in range(p): -            ans[i] += (A[k] - v) * invfact[k] * r[i] -            ans[i] %= p +    for i, a in enumerate(map(int, input().split())): +        if not a: +            continue +        u = [0] * (p + 1)  # u(x)=r(x)/(x-i) +        for k in range(p - 1, -1, -1): +            u[k] = (r[k + 1] + i * u[k + 1]) % p +            ans[k] -= u[k] +            ans[k] %= p