#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

class VariableModInt {
  long long x;
  static long long &mod() {
    static long long mod_num = 1;
    return mod_num;
  }

  public:
  VariableModInt(const long long num = 0) : x(num % get_mod()) { if (x < 0) x += get_mod(); }
  bool operator==(const VariableModInt &r) const { return this->x == r.x; }
  bool operator!=(const VariableModInt &r) const { return this->x != r.x; }
  bool operator<(const VariableModInt &r) const { return this->x < r.x; }
  bool operator>(const VariableModInt &r) const { return this->x > r.x; }
  bool operator<=(const VariableModInt &r) const { return this->x <= r.x; }
  bool operator>=(const VariableModInt &r) const { return this->x >= r.x; }
  VariableModInt operator+(const VariableModInt &r) const { return VariableModInt(*this) += r; }
  VariableModInt operator-(const VariableModInt &r) const { return VariableModInt(*this) -= r; }
  VariableModInt operator*(const VariableModInt &r) const { return VariableModInt(*this) *= r; }
  VariableModInt operator/(const VariableModInt &r) const { return VariableModInt(*this) /= r; }
  friend VariableModInt operator+(const long long &l, const VariableModInt &r) { return VariableModInt(l) += r; }
  friend VariableModInt operator-(const long long &l, const VariableModInt &r) { return VariableModInt(l) -= r; }
  friend VariableModInt operator*(const long long &l, const VariableModInt &r) { return VariableModInt(l) *= r; }
  friend VariableModInt operator/(const long long &l, const VariableModInt &r) { return VariableModInt(l) /= r; }
  VariableModInt &operator++() { return *this += 1; }
  VariableModInt &operator--() { return *this -= 1; }
  VariableModInt &operator+=(const VariableModInt &r) {
    x += r.x;
    if (x >= get_mod()) x -= get_mod();
    return *this;
  }
  VariableModInt &operator-=(const VariableModInt &r) {
    if (x < r.x) x += get_mod();
    x -= r.x;
    return *this;
  }
  VariableModInt &operator*=(const VariableModInt &r) {
    x = x * r.x % get_mod();
    return *this;
  }
  VariableModInt &operator/=(VariableModInt r) {
    *this *= r.inverse();
    return *this;
  }
  VariableModInt inverse(void) const {
    long long a = x, b = get_mod(), u = 1, v = 0;
    while (b) {
      long long t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return VariableModInt(u);
  }
  VariableModInt pow(long long n) const {
    VariableModInt ret(1), mul(x);
    while (n) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n  >>= 1;
    }
    return ret;
  }
  friend istream &operator>>(istream &is, VariableModInt &r) {
    long long n;
    is >> n;
    r = VariableModInt(n);
    return is;
  }
  friend ostream &operator<<(ostream &os, const VariableModInt &r) { return os << r.x; }
  static void set_mod(const long long mod_num) { mod() = mod_num; }
  static long long get_mod() { return mod(); }
  explicit operator int() const { return x; }
  explicit operator long long() const { return x; }
  explicit operator double() const { return x; }
};

template <typename T>
vector<T> lagrange_interpolation(const vector<T> &yvec) {
  const int n = yvec.size() - 1;
  vector<T> ret(n + 1), fac(n + 1), c(n + 2);
  fac[0] = 1;
  for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i;
  c[0] = 0, c[1] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j > 0; --j) {
      c[j] = c[j - 1] - c[j] * i;
    }
  }
  for (int i = 0; i <= n; ++i) {
    T c2 = 0, qi = yvec[i] / (fac[n - i] * fac[i]);
    if ((n - i) & 1) qi *= -1;
    for (int j = n; j >= 0; --j) {
      c2 = c[j + 1] + c2 * i;
      ret[j] += c2 * qi;
    }
  }
  return ret;
}

using mint = VariableModInt;
int main(void) {
  int p;
  cin >> p;
  mint::set_mod(p);
  vector<mint> a(p);
  rep (i, p) cin >> a[i];
  auto ans = lagrange_interpolation(a);
  rep (i, ans.size()) cout << ans[i] << (i != ans.size() - 1 ? " " : "\n");
  return 0;
}

Measured memory_bytes: 512