Buggy python submission (verdict: Time Limit Exceeded):
p=int(input())
A=list(map(int,input().split()))

B=[0]*p

INV=[None]*p# 1/aのリストを予め作っておく.
for i in range(1,p):
    INV[i]=pow(i,p-2,p)

Combi=[None]*p# Combi[i]=nCi を表す
Combi[0]=1
for i in range(1,p):
    Combi[i]=Combi[i-1]*(p-i)*INV[i] %p


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    for j in range(p):
        B[j]=(B[j]-Combi[j]*pow(-i,p-1-j,p))%p

print(*[b%p for b in B])

Fixed submission:
p=int(input())
A=list(map(int,input().split()))

B=[0]*p

INV=[None]*p# 1/aのリストを予め作っておく.
for i in range(1,p):
    INV[i]=pow(i,p-2,p)

Combi=[None]*p# Combi[i]=nCi を表す
Combi[0]=1
for i in range(1,p):
    Combi[i]=Combi[i-1]*(p-i)*INV[i] %p


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    POW=1
    for j in range(p):
        B[p-1-j]=(B[p-1-j]-Combi[j]*POW)%p
        POW=POW*(-i)%p

print(*[b%p for b in B])

Buggy python submission (verdict: Time Limit Exceeded):
p=int(input())
A=list(map(int,input().split()))

B=[0]*p
mod=p

FACT=[1]
for i in range(1,p):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(p-1,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    for j in range(p):
        B[j]=(B[j]-Combi(p-1,j)*pow(-i,p-1-j,p))%p

print(*[b%p for b in B])

    
    




Fixed submission:
p=int(input())
A=list(map(int,input().split()))

B=[0]*p

INV=[None]*p# 1/aのリストを予め作っておく.
for i in range(1,p):
    INV[i]=pow(i,p-2,p)

Combi=[None]*p# Combi[i]=nCi を表す
Combi[0]=1
for i in range(1,p):
    Combi[i]=Combi[i-1]*(p-i)*INV[i] %p


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    POW=1
    for j in range(p):
        B[p-1-j]=(B[p-1-j]-Combi[j]*POW)%p
        POW=POW*(-i)%p

print(*[b%p for b in B])

Buggy python submission (verdict: Time Limit Exceeded):
p=int(input())
A=list(map(int,input().split()))

B=[0]*p
mod=p

FACT=[1]
for i in range(1,p):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(p-1,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    for j in range(p):
        B[j]+=(-Combi(p-1,j)*pow(-i,p-1-j,p))%p

print(*[b%p for b in B])

    
    




Fixed submission:
p=int(input())
A=list(map(int,input().split()))

B=[0]*p

INV=[None]*p# 1/aのリストを予め作っておく.
for i in range(1,p):
    INV[i]=pow(i,p-2,p)

Combi=[None]*p# Combi[i]=nCi を表す
Combi[0]=1
for i in range(1,p):
    Combi[i]=Combi[i-1]*(p-i)*INV[i] %p


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    POW=1
    for j in range(p):
        B[p-1-j]=(B[p-1-j]-Combi[j]*POW)%p
        POW=POW*(-i)%p

print(*[b%p for b in B])

Buggy python submission (verdict: Time Limit Exceeded):
p=int(input())
A=list(map(int,input().split()))

B=[0]*p
mod=p

FACT=[1]
for i in range(1,p):
    FACT.append(FACT[-1]*i%mod)

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(p-1,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    for j in range(p):
        B[j]+=(-Combi(p-1,j)*pow(-i,p-1-j,p))%p

print(*[b%p for b in B])

    
    




Fixed submission:
p=int(input())
A=list(map(int,input().split()))

B=[0]*p

INV=[None]*p# 1/aのリストを予め作っておく.
for i in range(1,p):
    INV[i]=pow(i,p-2,p)

Combi=[None]*p# Combi[i]=nCi を表す
Combi[0]=1
for i in range(1,p):
    Combi[i]=Combi[i-1]*(p-i)*INV[i] %p


for i in range(p):
    if A[i]==0:
        continue

    B[0]+=1
    POW=1
    for j in range(p):
        B[p-1-j]=(B[p-1-j]-Combi[j]*POW)%p
        POW=POW*(-i)%p

print(*[b%p for b in B])