fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    val y = LongArray(n)
    for(i in 1..y.lastIndex) {
        y[i] = 2*a[i-1]-y[i-1]
    }
    y[0] = (2*a[n-1]-y[n-1])/2
    for(i in 1..y.lastIndex) {
        y[i] = 2*a[i-1]-y[i-1]
    }
    println(y.joinToString(" "))
}