import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.Map
import scala.collection.mutable.Queue

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N = in.next().toInt
  val A = new Array[Int](N+1)
  for (i <- 1 to N)
    A(i) = in.next().toInt




  //
  def check(num: Int): Int = {
    val memo = new Array[Int](N+1)
    memo(1) = num
    memo(N) = num
    for (i <- 2 to N) {
      val tmp = A(i-1) - memo(i-1)
      memo(i-1) += tmp
      memo(i) += tmp
    }

    val res = A(N) - memo(N)
    Math.abs(res)
  }

  // 下に凸のグラフの最小値
  def ternarySearchInt(small: Int, big: Int): Int = {
    if(big - small <= 2) {
      val mid = (big + small) / 2
      if(check(big) <= check(mid)) big
      else if(check(small) <= check(mid)) small
      else mid
    }
    else{
      val midl = (big + small) / 2
      val midr = midl + 1
      if (check(midl) >= check(midr))
        ternarySearchInt(midl, big)
      else
        ternarySearchInt(small, midr)
    }
  }


  val ans = ternarySearchInt(0, 1e9.toInt)

  val memo = new Array[Int](N+1)
  val com = new Array[Int](N+1)
  memo(1) = ans
  memo(N) = ans
  com(1) = ans
  for (i <- 2 to N) {
    val tmp = A(i-1) - memo(i-1)
    com(i) = tmp
    memo(i-1) += tmp
    memo(i) += tmp
  }

  val res = A(N) - memo(N)
  Math.abs(res)

  pw.print(com(1)*2)
  for(i <- 2 to N)
    pw.print(s" ${com(i)*2}")
  pw.println
  pw.flush()
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
