let () =
    let split s =
        let rec loop i cur flag acc =
            if i = String.length s then ( if flag then cur :: acc else acc) else (
                match flag, s.[i] with
                | true,  ' ' -> loop (i + 1) "" false (cur :: acc)
                | false, ' ' -> loop (i + 1) "" false acc
                | true,  v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
                | false, v   -> loop (i + 1) (Printf.sprintf "%s%c" cur v) true acc
            )
        in
        List.map int_of_string (List.rev (loop 0 "" false []))
    in
    let main () =
        let n = int_of_string (read_line ()) in
        let a = Array.of_list (split (read_line ())) in
        let f = Array.make n 0 in
        let (_, x) = Array.fold_left (fun (sign, sum) v -> -sign, sum + sign * v) (1, 0) a in
        f.(0) <- x;
        for i = 1 to n - 1 do
            f.(i) <- 2 * a.(i - 1) - f.(i - 1)
        done;
        Array.iter (Printf.printf "%d ") f;
        print_newline ()
    in
    main ()