// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;

// ModInt begin

ll mod;
using ll = long long;
struct ModInt {
    ll v;
    ll mod_pow(ll x, ll n) const {
        return (!n) ? 1 : (mod_pow((x*x)%mod,n/2) * ((n&1)?x:1)) % mod;
    }
    ModInt(ll a = 0) : v(((a %= mod) < 0) ? a + mod : a) {}
    ModInt operator+ ( const ModInt& b ) const {
        return (v + b.v >= mod ? ModInt(v + b.v - mod) : ModInt(v + b.v));
    }
    ModInt operator- () const {
        return ModInt(-v);
    }
    ModInt operator- ( const ModInt& b ) const {
        return (v - b.v < 0 ? ModInt(v - b.v + mod) : ModInt(v - b.v));
    }
    ModInt operator* ( const ModInt& b ) const {return (v * b.v) % mod;}
    ModInt operator/ ( const ModInt& b ) const {return (v * mod_pow(b.v, mod-2)) % mod;}
    
    bool operator== ( const ModInt &b ) const {return v == b.v;}
    bool operator!= ( const ModInt &b ) const {return !(*this == b); }
    ModInt& operator+= ( const ModInt &b ) {
        v += b.v;
        if(v >= mod) v -= mod;
        return *this;
    }
    ModInt& operator-= ( const ModInt &b ) {
        v -= b.v;
        if(v < 0) v += mod;
        return *this;
    }
    ModInt& operator*= ( const ModInt &b ) {
        (v *= b.v) %= mod;
        return *this;
    }
    ModInt& operator/= ( const ModInt &b ) {
        (v *= mod_pow(b.v, mod-2)) %= mod;
        return *this;
    }
    ModInt pow(ll x) { return ModInt(mod_pow(v, x)); }
    // operator int() const { return int(v); }
    // operator long long int() const { return v; }
};

ostream& operator<< (ostream& out, ModInt a) {return out << a.v;}
istream& operator>> (istream& in, ModInt& a) {
    in >> a.v;
    return in;
}

// ModInt end

const int V = 3000;
int main() {
    int P; cin >> P; mod = P;
    using mint = ModInt;
    vector< vector<mint> > table(V, vector<mint>(V));
    table[0][0] = mint(1);
    for(int i=1; i<V; i++) {
        table[i][0] = mint(1);
        for(int j=1; j<=i; j++) {
            table[i][j] = table[i-1][j-1] + table[i-1][j];
        }
    }

    vector<mint> A(P);
    for(int i=0; i<P; i++) {
        cin >> A[i];
    }

    vector< vector<mint> > pows(P, vector<mint>(P));
    for(int i=0; i<P; i++) {
        pows[i][0] = mint(1);
        for(int j=1; j<P; j++) {
            pows[i][j] = pows[i][j-1] * mint(i);
        }
    }

    vector<mint> B(P);
    for(int i=0; i<P; i++) {
        B[0] += A[i];
        for(int k=0; k<P; k++) {
            mint coeff = A[i] * table[P - 1][k] * pows[i][P-1-k];
            mint pari = k % 2 ? mint(1) : mint(-1);
            B[k] += coeff * pari;
        }
    }

    for(int i=0; i<P; i++) {
        cout << B[i] << " \n"[i + 1 == P];
    }
    return 0;
}


Measured memory_bytes: 141184