fun main(arr: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(" ").map { it.toLong() }
    val rain = LongArray(n)
    for(i in 2 until n step 2) {
        val diff = a[i] - a[i-1]
        rain[i] = rain[i-2] + diff * 2
    }
    rain[1] = rain.last() + (a[1] - a[0]) * 2
    for(i in 3 until n step 2) {
        val diff = a[i] - a[i-1]
        rain[i] = rain[i-2] + diff * 2
    }
    val ans = rain.dropLast(1).toMutableList()
    ans.add(0, rain.last())
    val adj = a[0] - (ans[1] + ans[0])/2
    println(ans.map { it+adj }.joinToString(" "))
}
