#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

template <class T1>
class Operators
{
public:
    template <class T2>
    const T1 operator+(const T2& right) const{
        T1 ans = static_cast<const T1&>( *this );
        return ans += right;
    }
    template <class T2>
    const T1 operator-(const T2& right) const{
        T1 ans = static_cast<const T1&>( *this );
        return ans -= right;
    }
    template <class T2>
    const T1 operator*(const T2& right) const{
        T1 ans = static_cast<const T1&>( *this );
        return ans *= right;
    }
    template <class T2>
    const T1 operator/(const T2& right) const{
        T1 ans = static_cast<const T1&>( *this );
        return ans /= right;
    }
    template <class T2>
    const T1 operator%(const T2& right) const{
        T1 ans = static_cast<const T1&>( *this );
        return ans %= right;
    }
    bool operator!=(const T1& right) const{
        const T1& left = static_cast<const T1&>( *this );
        return !(left == right);
    }
    bool operator>(const T1& right) const{
        const T1& left = static_cast<const T1&>( *this );
        return right < left;
    }
    bool operator<=(const T1& right) const{
        const T1& left = static_cast<const T1&>( *this );
        return !(right < left);
    }
    bool operator>=(const T1& right) const{
        const T1& left = static_cast<const T1&>( *this );
        return !(left < right);
    }
};

class Mod : public Operators<Mod>
{
private:
    long long a;
public:
    static int MOD;
    Mod(){
        a = 0;
    }
    Mod(long long x){
        a = (x % MOD + MOD) % MOD;
    }
    Mod& operator+=(const Mod& x){
        a = (a + x.a) % MOD;
        return *this;
    }
    Mod& operator-=(const Mod& x){
        a = (a - x.a + MOD) % MOD;
        return *this;
    }
    Mod& operator*=(const Mod& x){
        a = (a * x.a) % MOD;
        return *this;
    }
    Mod& operator/=(const Mod& x){ // フェルマーの小定理、MODが素数である場合のみ有効
        int b = MOD - 2;
        long long c = x.a;
        while(b > 0){
            if(b & 1){
                a *= c;
                a %= MOD;
            }
            c *= c;
            c %= MOD;
            b >>= 1;
        }
        return *this;
    }
    bool operator==(const Mod& x) const{
        return a == x.a;
    }
    long long getValue(){
        return a;
    }
};
int Mod::MOD;

Mod polynomialCalc(const vector<Mod>& v, Mod x)
{
    int n = v.size();
    Mod ans = 0;
    for(int i=n-1; i>=0; --i){
        ans *= x;
        ans += v[i];
    }
    return ans;
}

vector<Mod> polynomialMul(const vector<Mod>& v, Mod a)
{
    int n = v.size();
    vector<Mod> ans(n+1, 0);
    for(int j=0; j<n; ++j){
        ans[j+1] += v[j];
        ans[j] += v[j] * a;
    }
    return ans;
}

vector<Mod> polynomialDiv(vector<Mod> v, Mod a)
{
    int n = v.size();
    vector<Mod> ans(n-1, 0);
    for(int i=n-2; i>=0; --i){
        ans[i] = v[i+1];
        v[i+1] = 0;
        v[i] -= ans[i] * a;
    }
    return ans;
}

int main()
{
    int n;
    cin >> n;
    Mod::MOD = n;

    vector<Mod> a(n);
    for(int i=0; i<n; ++i){
        int tmp;
        cin >> tmp;
        a[i] = tmp;
    }

    vector<Mod> v(1, 1);
    for(int i=0; i<n; ++i)
        v = polynomialMul(v, -i);

    vector<Mod> ans(n, 0);
    for(int i=0; i<n; ++i){
        vector<Mod> v2 = polynomialDiv(v, -i);
        Mod val = polynomialCalc(v2, i);
        Mod coef = a[i] / val;
        for(int i=0; i<n; ++i)
            ans[i] += coef * v2[i];
    }

    cout << ans[0].getValue();
    for(int i=1; i<n; ++i)
        cout << ' ' << ans[i].getValue();
    cout << endl;

    return 0;
}


Measured memory_bytes: 512