#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1'000'000'000'000'000'000;
namespace utils{
    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
    using V_Set = unordered_set<int>;
    using E_Set = unordered_map<int, V_Set>;

#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
}
using namespace utils;

class poly{
    vector<ll> a;
public:
    poly(int deg) :a(deg) {};
    poly(vector<ll> t) :a(t) {};

    poly operator+(poly x){
        poly ans(a.size());
        for (int i = 0; i < ans.a.size(); ++i) {
            ans.a[i] = a[i] + x.a[i];
            ans.a[i] %= a.size();
        } // end i
        return ans;
    }

    void print(){
        for (auto &&i : a) {
            cout << i << ' ';
        } // end i
    }
};


vector<vector<ll>> choose;

void init_choose(int p){
    choose.resize(p+1, vector<ll>(p+1));
    for (int i = 0; i <= p; ++i) {
        choose[i][0] = 1; choose[i][i] = 1;
        for (int j = 1; j < i; ++j) {
            choose[i][j] = choose[i-1][j] + choose[i-1][j-1] ;
            choose[i][j] %= p;
        } // end j
    } // end i
}

ll pow(int x, int k, int p){
    int ans = 1;
    ll t = x;
    while(k > 0){
        if(k & 1){ ans *= t; ans %= p; }
        t *= t; t %= p;
        k /= 2;
    }
    return ans;
}

poly delta(int x, int p){

    vector<ll> ans(p,0);
    ans[0]= 1;
    for (int i = 0; i < p; ++i) {
        ans[i] -= choose[p-1][i] * pow(p-x, p-i-1, p);
    } // end i
    for (int i = 0; i < p; ++i) {
        if(ans[i] < 0){
            ans[i] = p - (-ans[i] % p) ;
        }
        else{ ans[i] = ans[i] % p;}
    } // end i
    return poly(ans);
}


void sub_main(istream &is) {
    ll p;
    is >> p;
    if(!is) return;
    poly ans(p);
    init_choose(p);
    for (int i = 0; i < p; ++i) {
        int a;
        is >> a;
        if(a == 1){
            ans = ans + delta(i, p);
        }
    } // end i
    ans.print();
    cout << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    string test_cases = "test_F.txt";
    cerr << "DEBUG MODE" <<  endl;
    cerr << test_cases << " -->" << endl;
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 72856