#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1

struct RuntimeModint {
  static int MOD;

  long long val;
  RuntimeModint(long long v = 0) noexcept : val(v% MOD) {
    if (val < 0) val += MOD;
  }
  int getmod() { return MOD; }
  RuntimeModint operator - () const noexcept {
    return val ? MOD - val : 0;
  }
  RuntimeModint operator + (const RuntimeModint& r) const noexcept { return RuntimeModint(*this) += r; }
  RuntimeModint operator - (const RuntimeModint& r) const noexcept { return RuntimeModint(*this) -= r; }
  RuntimeModint operator * (const RuntimeModint& r) const noexcept { return RuntimeModint(*this) *= r; }
  RuntimeModint& operator += (const RuntimeModint& r) noexcept {
    val += r.val;
    if (val >= MOD) val -= MOD;
    return *this;
  }
  RuntimeModint& operator -= (const RuntimeModint& r) noexcept {
    val -= r.val;
    if (val < 0) val += MOD;
    return *this;
  }
  RuntimeModint& operator *= (const RuntimeModint& r) noexcept {
    val = val * r.val % MOD;
    return *this;
  }
  bool operator == (const RuntimeModint& r) const noexcept {
    return this->val == r.val;
  }
  bool operator != (const RuntimeModint& r) const noexcept {
    return this->val != r.val;
  }
  friend ostream& operator << (ostream& os, const RuntimeModint& x) noexcept {
    return os << x.val;
  }
  friend istream& operator >> (istream& is, RuntimeModint& x) noexcept {
    return is >> x.val;
  }

  RuntimeModint pow(long long n) const noexcept {
    if (!n) return 1;
    auto t = pow(n >> 1);
    t *= t;
    if (n & 1) t *= *this;
    return t;
  }
  friend RuntimeModint modpow(const RuntimeModint& a, long long n) noexcept {
    return a.pow(n);
  }

  friend RuntimeModint Ncr(RuntimeModint a, int n) {
    RuntimeModint p = 1, q = 1;

    while (n > 0) {
      p *= a;
      a -= 1;
      q *= n--;
    }

    return p / q;
  }

  // for prime mod
  RuntimeModint inv() const { return pow(MOD - 2); }
  RuntimeModint& operator /= (const RuntimeModint& r) noexcept {
    long long a = r.val, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b; swap(a, b);
      u -= t * v; swap(u, v);
    }
    val = val * u % MOD;
    if (val < 0) val += MOD;
    return *this;
  }
  RuntimeModint operator / (const RuntimeModint& r) const noexcept { return RuntimeModint(*this) /= r; }
};
int RuntimeModint::MOD;
using rmint = RuntimeModint;

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  // b[0] + b[1]x + b[2]x^2 + ... + b[p-1]x^(p-1)

  int p;
  cin >> p;

  rmint::MOD = p;

  vector<rmint> fc(p), ifc(p);
  fc[0] = 1;
  ifc[0] = fc[0].inv();
  FOR(i, 1, p) {
    fc[i] = fc[i - 1] * i;
    ifc[i] = fc[i].inv();
  }

  // (x-i)^(p-1)
  vector<rmint> ncr(p);
  F0R(i, p) {
    // (p-1)C0 ~ (p-1)C(p-1)
    ncr[i] = fc[p - 1] * ifc[i] * ifc[p - 1 - i];
    //debug(fc[p - 1]); debug(ifc[i]); debug(ifc[p - 1 - i]);
    //cout << (p - 1) << " Choose " << (i) << " = " << ncr[i] << newl;
  }

  vector<rmint> as(p);

  F0R(i, p) {
    int a;
    cin >> a;
    if (a) {
      //debug(i);
      rmint b = 1;
      as[0] += 1;
      F0R(j, p) {
        as[p - 1 - j] -= b * ncr[j];
        b *= -i;
      }
    }
  }

  F0R(i, p) {
    cout << as[i] << ' ';
  }
}
#endif


Measured memory_bytes: 3724