import scala.io.StdIn._
object Main extends App {
  val n = readInt
  val as = readLine.split(" ").map(_.toInt)

  def calc(l: Int): Int = as.foldLeft(l / 2)((z, a) => a - z) * 2

  def binSearch(min: Int, max: Int): Int = {
    val mid = (min + max) / 2
    calc(mid) match {
      case `mid` => mid
      case l =>
        if (l < mid) binSearch(min, mid)
        else binSearch(mid, max)
    }
  }

  def rains(l: Int): Array[Int] = as.scanLeft(l)((z, a) => (a - z / 2) * 2).init

  println(rains(binSearch(0, 500000001)).mkString(" "))
}