import java.util.*

object Mod {
    var num: Long = 1000000007
    val inverse: HashMap<Long, Long> = hashMapOf()
    val factorial: HashMap<Long, Long> = hashMapOf()
}

infix fun Long.plM(other: Long): Long {
    return (this + other) % Mod.num
}

infix fun Long.mnM(other: Long): Long {
    return (this - other) % Mod.num
}

infix fun Long.tiM(other: Long): Long {
    return ((this % Mod.num) * (other % Mod.num)) % Mod.num
}

infix fun Long.diM(other: Long): Long {
    return ((this % Mod.num) * other.inverse()) % Mod.num
}

fun Long.power(num: Long): Long {
    var res: Long = 1
    var a = this
    var n = num
    while (n > 0) {
        if (n and 1L == 1L) {
            res = res tiM a
        }
        a = a tiM a
        n = n shr 1
    }
    return res
}

fun Long.inverse(): Long {
    val ans = Mod.inverse[this]
    return if (ans != null) {
        ans
    } else {
        val ans2 = this.power(Mod.num - 2)
        Mod.inverse[this] = ans2
        ans2
    }
}

fun Long.factorial(): Long {
    if (this == 1.toLong()) return 1
    val ans = Mod.factorial[this]
    return if (ans != null) {
        ans
    } else {
        val ans2 = (this - 1).factorial() tiM this
        Mod.factorial[this] = ans2
        ans2
    }
}

fun Long.combi(other: Long): Long {
    if (this < other) return 0
    if (other == this || other == 0.toLong()) return 1
    return this.factorial() tiM
            other.factorial().inverse() tiM
            (this - other).factorial().inverse()
}

fun main(args: Array<String>) {
    val p = readLine()!!.toInt()
    Mod.num = p.toLong()
    val array = readLine()!!.split(' ').map(String::toInt)
//    val start = System.currentTimeMillis()
//    Cache
    p.toLong().factorial()
    val p_1C = hashMapOf<Int, Long>()
    for (k in 0..(p - 1)) {
        p_1C[k] = (p - 1).toLong().combi(k.toLong())
    }

//    1 - (x-j)^(p-1)
    val ans = LongArray(p)
    for (i in 0 until p) {
        if (array[i] == 0) continue
        ans[0]++
        val j = i.toLong()
        var jTimes = 1L
        for (k in p-1 downTo 0) {
            ans[k] = ans[k] mnM (p_1C[k]!! tiM jTimes)
            jTimes = jTimes tiM -j
        }
    }
//    val stop = System.currentTimeMillis()
//    println("Total: ${stop - start} ms")

    for (res in ans) {
        print("${if (res >= 0) res else res + Mod.num} ")
    }
}
