let () = Scanf.scanf "%d\n" @@ fun n ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let xs = Array.make n 0 in
  xs.(0) <- Array.fold_left (fun acc a -> a - acc) 0 as_;
  Printf.printf "%d" xs.(0);
  for i = 1 to n - 1 do
    xs.(i) <- 2 * as_.(i - 1) - xs.(i - 1);
    Printf.printf " %d" xs.(i)
  done;
  print_newline ()

