type ABC(stream:System.IO.TextReader) =
  member this.Scan1 f = stream.ReadLine() |> f
  member this.Scan2 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1]))
  member this.Scan3 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2]))
  member this.Scan4 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2], a.[3]))
  member this.ScanVecH f = stream.ReadLine().Split() |> Array.map f
  member this.ScanVecV n f = [| for i in 1..n -> stream.ReadLine() |> f |]
  member this.ScanMatrix n f  = [| for i in 1..n -> stream.ReadLine().Split() |> Array.map f |]
  member this.ScanCharMatrix n = [| for i in 1..n -> stream.ReadLine().ToCharArray() |]
  member this.Close () = stream.Close()

let util = ABC(stdin)

let N = util.Scan1 int
let As = util.ScanVecH int64

let answer z =
  let xs = [0..N-2] |> List.scan (fun a -> fun x -> -a + As.[x]) z
  if As.[N-1] - (Seq.last xs) = z
  then Some xs
  else None


seq { 0L..2L*As.[0] } 
|> Seq.map answer
|> Seq.choose id
|> Seq.head
|> List.map (fun x -> sprintf "%d" (x * 2L))
|> String.concat " "

util.Close()