class Integer
  @@mod = 1000000007
  @@inverse = {}
  @@factorial = {}
  def self.mod
    @@mod
  end
  def self.mod=(value)
    @@mod = value
  end
  # a + b
  def plus(other)
    (self + other) % @@mod
  end
  # a - b
  def minus(other)
    (self - other) % @@mod
  end
  # a * b
  def mult(other)
    ((self % @@mod) * (other % @@mod)) % @@mod
  end
  # a / b
  def divi(other)
    ((self % @@mod) * other.inverse) % @@mod
  end
  # a ** b
  def power(n)
    res = 1
    a = self
    while (n > 0) do
      res = res.mult(a) if n[0]==1
      a = a.mult(a)
      n = n >> 1
    end
    res
  end
  # nCk
  def combi(k)
    return 0 if self < k
    return 1 if k == 0 || k == self
    self.! .divi (k.! .mult (self-k).!)
  end
  # 逆元
  def inverse
    @@inverse[self] ||= self.power(@@mod - 2)
  end
  # 階乗
  def factorial
    @@factorial[self] ||= (1..self).reduce(&:mult)
  end
  alias :! :factorial
end

# ABC 137-F
p = gets.to_i
Integer.mod = p
array = gets.split.map(&:to_i)
p_1C = {}
(0..(p-1)).each do |k|
  p_1C[k] = (p-1).combi(k)
end

# 1 - (x-j)^(p-1) = 0 if x != j
#                   1 if x == j
ans = Array.new(p, 0)
array.each_with_index do |x,i|
  next if x==0
  ans[0] = ans[0] .plus 1
  (0..(p-1)).each do |k|
    ans[k] = ans[k] .minus (p_1C[k] .mult (-i).power(p-1-k))
  end
end
puts ans.join(' ')