var fact: Array<Int> = Array(repeating: 0, count: 3020)
var factinv: Array<Int> = Array(repeating: 0, count: 3020)
var inv: Array<Int> = Array(repeating: 0, count: 3020)
var a1: Array<Int> = Array(repeating: 0, count: 0)
var ans: Array<Int> = Array(repeating: 0, count: 3020)
func init_nCk(n: Int, MOD: Int){
    fact[0] = 1;
    fact[1] = 1;
    factinv[0] = 1;
    factinv[1] = 1;
    inv[1] = 1;
    for i in 2...n + 5 {
        fact[i] = fact[i - 1] * i % MOD;
        inv[i] = MOD - inv [MOD % i] * (MOD / i) % MOD;
        factinv[i] = factinv[i - 1] * inv[i] % MOD;
    }
}
func nCk(n: Int, k: Int, MOD: Int) -> Int {
    assert(!(n < k));
    assert(!(n < 0 || k < 0));
    return fact[n] * (factinv[k] * factinv[n - k] % MOD) % MOD;
}
func readInts() -> [Int]{
    return readLine()!.split(separator: " ").map{Int($0)!};
}
let p = Int(readLine()!)!;
let a = readInts();
var count = 0;
for i in 0..<p {
    let aa = a[i];
    if aa == 1 {
        a1.append(i);
        count += 1;
    }
}
init_nCk(n: p - 1,MOD: p);
ans[0] = count;
for i in 0..<count {
    var x = 1;
    for j in 0..<p {
        let J = p - 1 - j;
        ans[J] -= nCk(n: p - 1, k: J, MOD: p) * x - p * p;
        ans[J] %= p;
        x *= -1 * a1[i];
        x %= p;
    }
}
for i in 0..<p {
    print(ans[i], terminator: "");
    if i < p - 1 {
        print(" ", terminator: "");
    }
}