#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

vector<int> prod(vector<int> A, vector<int> B, int p){
  vector<int> ret(A.size()+B.size()-1,0);
  for(size_t i = 0; i < A.size(); ++i){
    for(size_t j = 0; j < B.size(); ++j){
      ret[i+j] += A[i]*B[j]%p;
      ret[i+j] %= p;
      if(ret[i+j] < 0) ret[i+j] += p;
    }
  }
  return ret;
}

vector<int> div(vector<int> A, vector<int> B, int p){
  // A/B
  vector<int> ret(A.size()+1-B.size());
  for(int i = ret.size()-1; i >= 0; --i){
    ret[i] = A[i+B.size()-1]/B.back();
    for(int j = 0; j < B.size(); ++j){
      A[i+j] += p-ret[i]*B[j]%p;
      A[i+j] %= p;
      if(A[i+j] < 0) A[i+j] += p;
    }
  }
  return ret;
}

int main(){
  int p;
  cin >> p;
  vector<int> A(p);
  for(int i = 0; i < p; ++i) cin >> A[i];

  vector<int> F_inv(p);
  F_inv.back() = p-1;
  for(int i = p-1; i > 0; --i)
    F_inv[i-1] = (F_inv[i]*i)%p;

  vector<int> G = {1};
  for(int i = 0; i < p; ++i){
    G = prod(G,{-i,1},p);
  }

  vector<int> B(p,0);
  
  for(int i = 0; i < p; ++i){
    vector<int> T = div(G,{-i,1},p);
    assert(prod(T,{-i,1},p) == G);
    int c = F_inv[i]*F_inv[p-i-1]%p;
    if((p-i-1)%2) c = p-c%p;
    c *= A[i];
    
    for(int j = 0; j < p; ++j){
      B[j] += T[j]*c%p;
      B[j] %= p;
    }
  }

  for(int i = 0; i < p; ++i)
    cout << B[i] << ((i+1 < p) ? " " : "\n");

}
