fun main(args: Array<String>) {
    val (n) = readLine()!!.split(' ').map(String::toInt)
    val As = readLine()!!.split(' ').map(String::toInt)
    var b0 = 0
    var isPlus = true
    for(i in n-1 downTo 0){
        b0 += if(isPlus)As[i] else -As[i]
        isPlus = !isPlus
    }

    val Bs = Array<Int>(n){0}
    Bs[0] = b0

    for(i in 1 .. Bs.size - 1){
        Bs[i] = (As[i-1] - Bs[i-1] / 2) * 2
    }
    for(i in Bs.indices){
        print(Bs[i])
        if(i != Bs.size - 1) print(" ")
    }
}