There are N mountains in a circle, called Mountain 1, Mountain 2, ..., Mountain N in clockwise order. N is an odd number.
Between these mountains, there are N dams, called Dam 1, Dam 2, ..., Dam N. Dam i (1 \leq i \leq N) is located between Mountain i and i+1 (Mountain N+1 is Mountain 1).
When Mountain i (1 \leq i \leq N) receives 2x liters of rain, Dam i-1 and Dam i each accumulates x liters of water (Dam 0 is Dam N).
One day, each of the mountains received a non-negative even number of liters of rain.
As a result, Dam i (1 \leq i \leq N) accumulated a total of A_i liters of water.
Find the amount of rain each of the mountains received. We can prove that the solution is unique under the constraints of this problem.

-----Constraints-----
 - All values in input are integers.
 - 3 \leq N \leq 10^5-1
 - N is an odd number.
 - 0 \leq A_i \leq 10^9
 - The situation represented by input can occur when each of the mountains receives a non-negative even number of liters of rain.

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 A_2 ... A_N

-----Output-----
Print N integers representing the number of liters of rain Mountain 1, Mountain 2, ..., Mountain N received, in this order.

-----Sample Input-----
3
2 2 4

-----Sample Output-----
4 0 4

If we assume Mountain 1, 2, and 3 received 4, 0, and 4 liters of rain, respectively, it is consistent with this input, as follows:
 - Dam 1 should have accumulated \frac{4}{2} + \frac{0}{2} = 2 liters of water.
 - Dam 2 should have accumulated \frac{0}{2} + \frac{4}{2} = 2 liters of water.
 - Dam 3 should have accumulated \frac{4}{2} + \frac{4}{2} = 4 liters of water.

Difficulty: interview

Starter code:

Solutions:
n = int(input())
a = list(map(int, input().split()))
ans = a[0]
l = []

for i in range(1, n, 2):
    ans -= a[i]
    ans += a[i + 1]

l.append(ans)

for i in range(n - 1):
    ans = (a[i] - ans//2)*2
    l.append(ans)

for i in l:
    print(i, end = " ")

N = int(input())
A = list(map(int, input().split()))

sum_A = sum(A)

x1 = sum_A - 2 * (sum(A[1:N:2]))

ans = [x1]
for i in range(N):
    if (i == 0):
        continue
    if (i + 1 == N):
        ans.append(2 * A[i] - x1)
        break

    ans.append((2 * A[i - 1]) - ans[i - 1])

print((*ans))


N = int(input())
A = list(map(int, input().split()))

x2 = 0
for i in range(N):
    if i % 2:
        x2 -= A[i]
    else:
        x2 += A[i]

ans = [0]*N
ans[0] = x2//2
for i in range(N-1):
    ans[i+1] = A[i]-ans[i]

for i in range(N):
    ans[i] *= 2

print((' '.join(map(str, ans))))


N = int(input())
A = list(map(int, input().split()))
S = 0
sign = 1
for i in range(N):
  S += sign * A[i]
  sign *= -1
for i in range(N):
  print(S, end = ' '*(i<N-1))
  S *= -1
  S += 2*A[i]
print()


def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    X = [0] * N

    # X1 = S-(X2...XN)になる
    # また、(X1 + X2)//2 = A1 より X1 + X2 = 2*A1
    # なので、 X1 = S - 2(A2+A4+An-1) になる
    S = sum(A)
    X[0] = S - sum(A[1::2]) * 2

    # O(N) で解くために、 Xi+1 = 2*A1 - Xi
    for i in range(N - 1):
        X[i + 1] = 2 * A[i] - X[i]

    print(*X)


def __starting_point():
    resolve()
__starting_point()

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))

mFR = [0]*(N+1)
for i in range(N):
    mFR[1] += A[i]*(pow(-1,i))
for i in range(2,N+1):
    mFR[i] = A[i-2]*2-mFR[i-1]
print((*mFR[1:]))


n=int(input())
a=list(map(int,input().split()))

#n=3
#a=[2,2,4]

b=[0]*n
x=[0]*n
bsum=0
for i in range(0,n-1,2):
    bsum+=a[i]-a[i+1]
b[0]=bsum
x[0]=b[0]+a[n-1]
for i in range(1,n):
    b[i]=a[i-1]-b[i-1]-a[(n+i-2)%n]
    x[i]=b[i]+a[(i+n-1)%n]
    
strx=" ".join(str(xi) for xi in x)
print(strx)

N=int(input())
A=list(map(int,input().split()))

X0=0

for i in range(N):
  if i%2==0:
    X0+=A[i]
  else:
    X0-=A[i]

ans=[X0]

for i in A:
  ans.append((i-ans[-1]//2)*2)
print(*ans[:-1])

N = int(input())
A = list(map(int, input().split()))

S = sum(A)
X = [0]*N
X[0] = S-2*sum(A[1:N:2])
for i in range(1, N):
    X[i] = 2*A[i-1]-X[i-1]
print((*X))


n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    if i%2 == 0:
        ans += a[i]
    else:
        ans -= a[i]
ans1 = ans
print(ans, end=' ')
for i in range(1, n):
    ans *= -1
    ans += 2*a[i-1]
    print(ans, end=' ')
    
print()


N = int(input())
A = list(map(int, input().split()))

# 各山に降った雨の量
x = [-1] * N

# まずx[0]を求める
# x[0] = s - 2 * (A_2+A_4+...+A_N-1)
s = sum(A)
temp = 0
for i in range(2, N, 2):
    temp += A[i - 1]
x[0] = s - 2 * temp

# x[1],x[2],...,x[N-1]を漸化式から求める
for i in range(1, N):
    x[i] = 2 * A[i - 1] - x[i - 1]
print((*x))


N = int(input())
A = [int(_) for _ in input().split()]

ans = [sum(A) - 2 * sum(A[1::2])]
for a in A[:-1]:
    ans.append(a * 2 - ans[-1])

print((" ".join([str(_) for _ in ans])))


n = int(input())
a = list(map(int, input().split()))
l = []

ans = sum(a[0::2]) - sum(a[1::2])
l.append(ans)

for i in range(n - 1):
    l.append(a[i]*2 - l[i])

print(*l)

import sys
input=sys.stdin.readline

N=int(input().rstrip('\n'))
As = [int(x) for x in input().rstrip('\n').split()]
total = sum(As)
half = []
for i in range(N):
  if i==0:
    half.append((total-sum(As[1::2])*2)//2)
  else:
    half.append(As[i-1]-half[-1])
print(*[x*2 for x in half])

N = int(input())
A = list(map(int,input().split()))

X = [0] * N

X[0] += sum(A) - 2 * sum(A[1::2])

for i in range(1,N):
  X[i] = (2 * A[i-1]) - X[i-1]
  
print(*X)

n = int(input())
a = list(map(int, input().split()))
a_0 = sum(a) - 2 * sum(a[1::2])
ans = []
ans.append(a_0)
for i, A in enumerate(a[:-1], 1):
    ans.append(2 * A - ans[i-1])

print(*ans)

import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    N = i_input()
    A = i_list()

    a = 0
    for i,k in enumerate(A):
        if i%2 == 0:
            a += k
        else:
            a -= k
  
    ans = [a]
    for i,k in enumerate(A[:-1]):
        t = k - ans[-1]//2
        ans.append(2*t)
    print((" ".join(map(str, ans))))


   

def __starting_point():
    main()


__starting_point()

import sys


def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())


N = IN_I()
A = IN_LI()

b = [0] * N
S = sum(A)
b[0] = S - 2 * sum(A[1::2])

for i in range(1, N):
    b[i] = 2 * A[i - 1] - b[i - 1]

print((' '.join(map(str, b))))



N = int(input())
A = list(map(int,input().split()))

All = sum(A)

lim = len(A)//2
Exc1 = sum([A[2*i+1] for i in range(lim)])

one = All - Exc1*2
ans = [one]
for i in range(1,N):
    print('{}'.format(ans[-1]),end=' ')
    ans.append(A[i-1]*2 - ans[-1])
print('{}'.format(ans[-1]))


#!/usr/bin/env python3
n, *a = list(map(int, open(0).read().split()))
b = [0]
for i in a:
    b[0] = i - b[0]
for i in a:
    b.append((i - b[-1] // 2) * 2)
print((*b[:n]))


def main():
	N = int(input())
	A = [int(a) for a in input().split(" ")]
	exA = A * 2
	S = sum(A)
	D = [sum(A[1::2]), sum(A[2::2])]
	for i in range(2, N):
		D.append(D[-2] - exA[i - 1] + exA[i + N - 2])
	print((" ".join([str(S - 2 * d) for d in D])))

main()


n = int(input())
a = list(map(int, input().split()))

x = sum([a[i]*(-1)**(i%2) for i in range(n)])
ans = [x]
for i in range(n-1):
    ans.append(2*a[i]-ans[-1])
print(' '.join(map(str, ans)))

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    X = [0] * N
 
    # X1 = S-(X2...XN)になる
    # また、(X1 + X2)//2 = A1 より X1 + X2 = 2*A1
    # なので、 X1 = S - 2(A2+A4+An-1) になる
    S = sum(A)
    X[0] = S - sum(A[1::2]) * 2
 
    # O(N) で解くために、 Xi+1 = 2*A1 - Xi
    for i in range(N - 1):
        X[i + 1] = 2 * A[i] - X[i]
 
    print(*X)
 
 
def __starting_point():
    resolve()
__starting_point()

n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
ans[0]=sum([2*a[i] for i in range(1,n,2)])
ans[0]=sum(a)-ans[0]

for i in range(n-1):
  ans[i+1]=2*a[i]-ans[i]

print((*ans))


N=int(input())
A=list(map(int,input().split()))

B=[0 for i in range(N)]

B[0]=2
while 1:
  for i in range(1,N):
    B[i]=2*A[i]-B[i-1]
  if B[0]==2*A[0]-B[-1]:break
  else:
    B[0]= (B[0] + (2*A[0]-B[-1]))//2

B = [B[-1]]+B[:-1]

print(*B)

n = int(input())
A = list(map(int,input().split()))

answers = [0]*n

answers[n-1] = sum(A)//2-sum(A[0:n-1:2])

for i in range(n-2,-1,-1):
    answers[i] = A[i] - answers[i+1]

print(*[2*a for a in answers])

N=int(input())
l=list(map(int,input().split()))
sum_n=sum(l)
first=sum_n-(2*sum([l[i] for i in range(1,N,2)]))
ans=[first]
for i in range(N-1):
   ans.append(2*l[i]-ans[-1])
print(*ans)

n=int(input())
inp=list(map(int,input().split()))
inp=[2*item for item in inp]
s=0
for i in range(1,len(inp)):
    if i%2==1:
        s-=inp[i]
    else:
        s+=inp[i]
ans=[(s+inp[0])//2]
for i in range(len(inp)-1):
    ans.append(inp[i]-ans[-1])
for item in ans:
    print (item,end=" ")

n=int(input())
a=list(map(int,input().split()))
s=sum(a)//2
x=s-sum(a[1::2])
table=[x]
for i in range(n-1):
    table.append(a[i]-x)
    x=a[i]-x
ans=list(map(lambda x:2*x,table))
print(*ans)

import copy
N = int(input())
A = [int(x) for x in input().split()]
suma = sum(A)
x0 = 0
for i in range(N) :
    x0 += ((-1)**i) * A[i]

x = [x0]

for i in range(1,N) :
    xi = (A[i-1] - x[i-1]//2)*2
    x.append(xi)

for i in range(N) :
    print(x[i],end=' ')

n=int(input())

a=list(map(int,input().split()))

m=sum(a[0::2])-sum(a[1::2])

M=[m]

for i in range(n-1):
    M.append(2*a[i]-M[i])

print(*M)

N=int(input())
A=list(map(int,input().split()))
X=[]
s=sum(A)
for i in range(1,N,2):
  s-=2*A[i]
X.append(s)

for i in range(N-1):
  x=2*A[i]-X[i]
  X.append(x)
print((*X))


n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
ans[0]=sum(2*a[1::2])
ans[0]=sum(a)-ans[0]

for i in range(n-1):
  ans[i+1]=2*a[i]-ans[i]

print((*ans))


e = 0
s = 0
n = int(input())
a = list(map(int,input().split()))

for i in range(n): 
    s += a[i]
    if i % 2 == 1:
        e += a[i]

b = []
for i in range(n):
    if (i == 0):
        b.append(s-2*e)
    else:
        b.append(2*a[i-1]-b[i-1])

print(" ".join(map(str,b)))

N = int(input())
A = [int(x) for x in input().split()]
x = [0]*N
for i in range(N):
  x[0] += ((-1)**i)*A[i]
for i in range(1,N):
  x[i] = -x[i-1]+2*A[i-1]
for i in range(N):
  print(x[i],end=" ")
print()

N = int(input())
A = list(map(int, input().split()))

ans = [0 for _ in range(N)]

sign = 1
for a in A:
    ans[0] += sign * a
    sign *= -1


for i in range(1, N):
    ans[i] = 2 * A[0] - ans[i - 1]

    t = A.pop(0)
    A.append(t)

print((*ans))


N = int(input())
A = list([int(x) for x in input().split()])

result = [0] * N
x = 0
for key, i in enumerate(A):
    if key % 2 == 0:
        x += i
    else:
        x -= i

result[0] = x

for i in range(1, N):
    result[i] = 2 * A[i-1] - result[i-1]

print((' '.join([str(x) for x in result])))


N = int(input())
A = list(map(int,input().split()))

ans = [sum(A)//2 - sum([A[i] for i in range(1,N,2)])]

for i in range(N-1):
    ans.append(A[i] - ans[-1])

for x in ans:
    print(2*x, end=" ")
print("")

N = int(input())
A = list(map(int, input().split()))

ans = [0 for _ in range(N)]

sign = 1
for a in A:
    ans[0] += sign * a
    sign *= -1


for i in range(1, N):
    ans[i] = 2 * A[i-1] - ans[i - 1]

print((*ans))

"""
ダム1: 2( a1 - a2 + a3 )
ダム2: 2( a2 - a3 + a1 )
ダム3: 2( a3 - a1 + a2 )
"""


N = int(input())
A = [int(x) for x in input().split()]

t = 0
for i in range(N):
    if i % 2 == 0:
        t += A[i]
    else:
        t -= A[i]
for a in A:
    print(t, "", end="")
    t = -t + a * 2
print()


N = int(input())
A = list(map(int, input().split()))
X = [0]*N
S = 0
As = 0
for i in range(N):
    S += A[i]
for i in range((N - 1) // 2):
    As += A[2 * i + 1]
X[0] = S - 2 * As
for i in range(1,N):
    X[i] = 2 * A[i-1] - X[i-1]
s = ""
for i in range(N):
    s += str(X[i]) + " "
print(s)

def main():
    n = int(input())
    A = list(map(int, input().split()))
    ans = []

    x1 = 0
    for i, ai in enumerate(A):
        x1 += ai if i % 2 == 0 else -ai
    x1 //= 2
    ans.append(x1)

    for a in A[:-1]:
        ans.append(a - ans[-1])

    print((" ".join(str(a * 2) for a in ans)))


def __starting_point():
    main()

__starting_point()

n = int(input())
alst = list(map(int, input().split()))

ans = [0 for _ in range(n)]
pm = 1
for a in alst:
    ans[0] += a * pm
    pm *= -1
for i in range(n - 1):
    ans[i + 1] = alst[i] * 2 - ans[i]
print(*ans)

# 解説を参考に作成
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(N, As):
    S = sum(As)
    Xs = [0] * N
    Xs[0] = S - (sum(As[1::2]) * 2)
    for i in range(1, N):
        Xs[i] = 2 * As[i - 1] - Xs[i - 1]
    print((' '.join([str(i) for i in Xs])))


def __starting_point():
    # S = input()
    N = int(input())
    # N, M = map(int, input().split())
    As = [int(i) for i in input().split()]
    # Bs = [int(i) for i in input().split()]
    solve(N, As)

__starting_point()


def resolve():
    N = int(input())
    A = list(map(int, input().split()))

    ans = [0] * N
    ans[0] = sum(A)

    for i in range(1, N, 2):
        ans[0] -= 2 * A[i]

    for i in range(N - 1):
        ans[i + 1] = 2 * A[i] - ans[i]

    print(*ans)


def __starting_point():
    resolve()
__starting_point()

n=int(input())
a=list(map(int, input().split()))
x=[0]*n
s1=sum(a)
s2=0
for i in range(1,n-1,2):
  s2+=a[i]

x[0]=s1-s2*2

for i in range(1,n):
    x[i]=-x[i-1]+2*a[i-1]

x=[str(a) for a in x]
x=' '.join(x)
print(x)

N = int(input())
A = list(map(int,input().split()))

S = sum(A)
damu_sum = sum(A[1::2])
ans = S - 2 * (damu_sum)

ans_list = [ans]

for i in range(N-1):
    ans = 2 * A[i] - ans
    ans_list.append(ans)
print(*ans_list)

import math
n = int(input())
A = list(map(int, input().split( )))
x1 = 0
for i in range(n):
  x1 += ((-1)**i)*A[i]
arr = [x1]
s = x1//2
for i in range(n-1):
  s = A[i]-s
  arr.append(s*2)
print((' '.join(map(str, arr))))




# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left, bisect_right
from functools import lru_cache
MOD = int(1e9)+7
INF = float('inf')


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    
    s = sum(a)
    x = s - 2 * sum(e for i, e in enumerate(a) if i % 2)

    ans = [0] * n
    ans[0] = x
    for i in range(1, n):
        ans[i] = 2 * a[i-1] - ans[i-1]
    print((*ans))

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""
1
4
-1 1 1 -1

"""


n = int(input())
aa = list(map(int, input().split()))

x = 0
for i in range(n):
  if i % 2 == 0:
    x += aa[i]
  else:
    x -= aa[i]
    
ans = [x]
for i in range(n-1):
  x = 2 * (aa[i] - x//2)
  ans.append(x)
print(*ans)

# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr
tot = sum(A)
wo_X0 = 0
for i in range(1, N, 2):
    wo_X0 += A[i]
X = []
X.append(tot - 2 * wo_X0)

for i in range(1, N):
    X.append(2 * A[i - 1] - X[i - 1])

for x in X:
    print(x, end = ' ')

N = int(input())
A = tuple(map(int, input().split()))

r = [0] * N
for i, a in enumerate(A):
    if i % 2 == 0:
        r[0] += a
    else:
        r[0] -= a
r[-1] = 2 * A[-1] - r[0]
for i in range(N - 2, 0, -1):
    r[i] = 2 * A[i] - r[i+1]
ans = " ".join(map(str, r))
print(ans)

import sys

def read_str(): return sys.stdin.readline().strip()
def read_int(): return int(sys.stdin.readline().strip())
def read_ints(): return list(map(int, sys.stdin.readline().strip().split()))
def read_str_split(): return list(sys.stdin.readline().strip())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))

def Main():
    n = read_int()
    a = read_int_list()
    ans = [0] * n
    ans[0] = sum(a) - 2 * sum(a[1::2])
    for i in range(1, n):
        ans[i] = 2 * a[i - 1] - ans[i - 1]
    print((*ans))

def __starting_point():
    Main()

__starting_point()

import sys
input = sys.stdin.readline

N = int(input())
A = list(map(int,input().split()))

mFR = [0]*(N+1)
for i in range(N):
    mFR[1] += A[i]*((-1)**i)
for i in range(2,N+1):
    mFR[i] = A[i-2]*2-mFR[i-1]
print((*mFR[1:]))


N = int(input())
A = list(map(int,input().split()))
ans = [0]*N
ans[0] = sum([(-1)**i*A[i] for i in range(N)])
for i in range(1,N):
    ans[i] = 2*A[i-1]-ans[i-1]
print(*ans)

def main():
    import sys

    def input(): return sys.stdin.readline().rstrip()

    n = int(input())
    a = list(map(int, input().split()))
    x = [0]*n
    x[0] = (sum(a[::2])-sum(a[1::2]))
    for i in range(1, n):
        x[i] = 2*a[i-1]-x[i-1]
    print(*x)

def __starting_point():
    main()
__starting_point()

N = int(input())
A = list(map(int, input().split()))
A = A * 2

s = [0] * (2 * N)
s[0] = A[0]
s[1] = A[1]

for i in range(2, 2*N):
    s[i] = s[i-2] + A[i]
s.append(0)
ss = s[2 * N - 1]

for i in range(N):
    print(ss - 2 * (s[i + N - 2] - s[i-1]), end=" ")


n=int(input())
a=list(map(int,input().split()))
ans=[0]*n
sum=0
for i in range(n-1):
    if i%2==0:
        sum-=a[i]
    else:
        sum+=a[i]
sum+=a[n-1]
ans[-1]=sum
for j in range(0,n-1)[::-1]:
    ans[j]+=(2*a[j]-ans[j+1])
for k in range(n):
    ans[k]=str(ans[k])
print((" ".join(ans)))


N = int(input())
A = list(map(int,input().split()))
B = N*[0]

for n in range(N):
  if n%2==0:
    B[0]+=A[n]
  else:
    B[0]-=A[n]

for n in range(N):
  if n==0:
    pass
  elif 1<=n<=N-1:
    B[n] = 2*A[n-1]-B[n-1]
  else:
    B[n] = 2*A[n]-B[0]

print(*B)

N = int(input())
A = list(map(int, input().split()))
x = 0
for i in A:
    x = i-x
print(x, end=" ")
x//=2
for i in range(N-1):
    x = A[i]-x
    print(2*x, end=" ")


# ABC 133 D
N = int(input())
A_list = list(map(int, input().split()))
x_list = [0] * N
x_list[0] = sum(A_list) - sum([2*a for a in A_list[1::2]])
for i, a in enumerate(A_list[:-1]):
    x_list[i+1] = 2*a - x_list[i]

print(*x_list)

N=int(input())
A=list(map(int,input().split()))
s=sum(A)
ans=[s-2*sum(A[1::2])]
for i in range(0,N-1):
    ans.append(A[i]*2-ans[-1])
print(*ans)

n = int(input())
a = list(map(int,input().split()))

x = [0]*n

x[0] = sum(a)-2*(sum(a[1::2])) 
for i in range(n-1):
    x[i+1] = 2*a[i] - x[i]

print(*x,end="")

#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n=INT()
    A=LIST()
    ans=[0]*n
    rain=sum(A)
    temp=rain
    for i in range(n):
        if i%2==1:
            temp-=A[i]*2
    ans[0]=temp
    for i in range(1,n):
        ans[i]=A[i-1]*2-ans[i-1]
    
    print(*ans)

def __starting_point():
    do()
__starting_point()

n=int(input())
A=list(map(int,input().split()))
X=[0]*n
S=sum(A)
A2=0
for i in range(1,n-1,2):
  A2+=A[i]
X[0]=S-2*A2
for i in range(1,n):
  X[i]=2*A[i-1]-X[i-1]
print(*X)

# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    N = int(input())
    A_lsit = list(map(int, input().split()))

    mount1_min = 0
    mount1_max = min(A_lsit[0], A_lsit[-1])

    mount_list = [0]*N

    while True:
        mount_list[0] = (mount1_min + mount1_max)//2
        for i in range(N-1):
            mount_list[i+1] = A_lsit[i] - mount_list[i]
        #print(mount_list)
        if A_lsit[N-1] - mount_list[N-1] == mount_list[0]:
            break
        elif A_lsit[N-1] - mount_list[N-1] < mount_list[0]:
            mount1_max = mount_list[0]
        else:
            if mount1_min != mount_list[0]:
                mount1_min = mount_list[0]
            else:
                mount1_min = mount_list[0]+1
    print((" ".join([str(m*2) for m in mount_list])))

def __starting_point():
    main()


__starting_point()

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = [0]*n
k = 0
for i in range(n//2):
    k += 2*a[2*i+1]
b[0] = sum(a) - k

for i in range(1, n):
    b[i] = 2*a[i-1] - b[i-1]
print(*b)

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy
from operator import itemgetter

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ni()
A = na()
tmp = 0
now = 1
for i in range(N):
    A[i] *= 2
    tmp += now  * A[i]
    now *= -1

ans = [0] * N
ans[0] = tmp // 2
for i in range(N-1):
    ans[i+1] = A[i] - ans[i]
ans[N-1] = A[N-1] - ans[0]
print(*ans)

n = int(input())
data = list(map(int, input().split()))
ans = [0]
for idx, a in enumerate(data):
    if idx%2 == 0:
        ans[0] += a
    else:
        ans[0] -= a

for i in range(n-1):
    dam = data[i]
    score = 2*dam - ans[-1]
    ans.append(score)

print(*ans)

n=int(input())
a=list(map(int,input().split()))
num=0
for i in range(n):
  if i%2==0:
    num=num+a[i]
  else:
    num=num-a[i]
k=num
for i in range(n):
  print(k,end=" ")
  k=2*a[i]-k
  

N = int(input())
A = list(map(int,input().split()))
B = [2*sum(A[::2])-sum(A)]

for n in range(N-1):
  B+=[2*A[n]-B[n]]

print(*B)

N = int(input())
As = list(map(int, input().split()))

ansList = []
ans_1 = 0
for i in range(N):
    ans_1 += As[i] * (-1) ** i

ansList.append(ans_1)

for A in As[:-1]:
    ansList.append(2 *A - ansList[-1])

print(' '.join(map(str, ansList)))

n=int(input())
a=list(map(int,input().split()))
b=sum(a)
ans=[0]*n
for i in range(n//2):
    ans[(i+1)*2]=ans[i*2]-(2*(a[i*2]-a[i*2+1]))
ans[1]=ans[-1]-(2*(a[-1]-a[0]))
for i in range(1,n//2):
    ans[i*2+1]=ans[(i-1)*2+1]-(2*(a[(i-1)*2+1]-a[i*2]))
c=(b-sum(ans))//n
ans2=[0]*n
for i in range(n):
    ans2[i]=c+ans[i]
print((*ans2))


N = int(input())
*A, = list(map(int, input().split()))
B = [0] * N
for i in range(N):
    B[0] -= A[i] * (i%2*2-1)
for i in range(1, N):
    B[i] = A[i-1]*2 - B[i-1]
print((*B))


n = int(input())
a = list(map(int,input().split()))
ans = []
cnt = 0
for i in range(1,n-1,2):
  cnt += a[i]*2  
ans.append(sum(a)-cnt)
for i in range(n):
  ans.append(a[i]*2-ans[i])
print(*ans[:-1])

N = int(input())
A = list(map(int,input().split()))

temp = sum(A)
for i in range(1, N, 2):
  temp -= A[i] * 2

R = [0] * N
R[0] = temp

for i in range(1, len(R)):
  R[i] = A[i - 1] * 2 - R[i - 1]

print(*R)

N = int(input())
lsA = list(map(int,input().split()))
x1_2 = 0
for i in range(N):
    if i % 2 == 0:
        x1_2 += lsA[i]
    else:
        x1_2 -= lsA[i]
x1 = x1_2//2
lsx = [x1]
for i in range(N):
    lsx.append(lsA[i]-lsx[i])
lsx2 = [str(2*lsx[i]) for i in range(N)]
print(' '.join(lsx2))

N=int(input())
*A,=map(int,input().split())
B=[0]*N
a1=A[0]
i=1
while i<N:
    a1+=A[i+1]-A[i]
    i+=2
B[0]=a1
i=1
while i<N:
    B[i]=2*(A[i-1]-B[i-1]//2)
    i+=1
print(*B)

n = int(input())
a = list(map(int, input().split()))
ans = a[0]
l = []

for i in range(1, n, 2):
    ans -= a[i]
    ans += a[i + 1]

l.append(ans)

for i in range(n - 1):
    ans = a[i]*2 - ans
    l.append(ans)

print(*l)

n = int(input())
a = list(map(int, input().split()))
b = [0]*n
#print(a)
sum_r = sum(a)
tmp = 0
#print(sum)
for i in range(n//2+1):
    #print(i*2)
    tmp += a[i*2]*2

b[0] = tmp-sum_r
#print(b[0])
for i in range(1,n):
    b[i] = a[i-1]*2-b[i-1]
    
print((" ".join([str(i) for i in b])))


n=int(input())
a=list(map(int,input().split()))
a_=sum(a)
b=0
for i in range(1,n,2):
    b+=2*a[i]
ans=a_-b
c=[]
c.append(str(ans))
for i in range(n-1):
    ans=2*a[i]-ans
    c.append(str(ans))
print((' '.join(c)))




n = int(input())
a = list(map(int,input().split()))

sum_a = sum(a)
ans = [0]*n
ans[0] = sum_a - 2*(sum(a[1:n-1:2]))
for i in range(1,n):
    ans[i] = 2*a[i-1] - ans[i-1]
print(*ans)

N = int(input())
A = list(map(int, input().split()))

tmp = 0
for i in range(N//2):
  tmp += A[2*i+1]
  
ans = []
if sum(A) > 2*tmp:
  ans.append(sum(A)-2*tmp)
else:
  ans.append(0)
  
for i in range(N-1):
  ans.append(2*A[i]-ans[-1])
print((*ans))


n=int(input())
a=list(map(int,input().split()))

s=sum(a)

ans=[]

s1=0

for i in range(n):
  if i%2==1:
    s1+=a[i]
    
ans.append(str(s-s1*2))
for j in range(n-1):
  ans.append(str(a[j]*2-int(ans[-1])))
  
print(' '.join(ans))

n = int(input())
a = list(map(int,input().split()))
ans = [0] * n
ans[0] = sum(a) - 2 * (sum(a[1::2]))
for i in range(1,n):
    ans[i] = 2*a[i-1]-ans[i-1]
print(' '.join(map(str,ans)))

n = int(input())
a =  list(map(int, input().split()))

total = 0
for i in range(n):
    total += a[i]*(1 if i%2==0 else -1)

ans = [total]

for i in range(0, n-1):
    ans.append(2*a[i]-ans[i])

print(" ".join(map(str, ans)))

N = int(input())
A = list(map(int,input().split()))
x = [None]*N
sm = 0
sign = 1
for i in range(N):
    sm += sign*A[i]
    sign *= -1
x[0] = sm // 2
for i in range(1,N):
    x[i] = A[i-1]-x[i-1]
print(*map(lambda a: a*2, x))

n = int(input())
a = list(map(int,input().split()))

x = [0]*n
for i in range(n):
    x[0] += (-1)**(i) * a[i]
    
for i in range(1,n):
    x[i] = 2*a[i-1] - x[i-1]
    
for i in range(n):
    print(x[i],end="")
    print(" ",end="")

def main():
    import sys
    input = lambda:sys.stdin.readline().strip()
    
    N = int(input())
    A = list(map(int,input().split()))

    #i%2==0を加算、i%2==1を減算すれば山1の高さになる。
    tmp = 0
    for i in range(N):
        if i%2==0:
            tmp+=A[i]
        else:
            tmp-=A[i]

    ans = [tmp]
    for i in range(N-1):
        tmp = (A[i]-tmp//2)*2
        ans.append(tmp)

    print(*ans)
        
def __starting_point():
    main()
__starting_point()

N = int(input())
A = [int(x) for x in input().split()]
 
s_sum = sum(A)
 
ans = [None] * N
 
ans[0] = s_sum
for i in range(1, N, 2):
  ans[0] -= 2 * A[i]
 
for i in range(N-1):
  ans[i + 1] = 2 * A[i] - ans[i]
 
print(*ans)

from math import ceil,floor,factorial,gcd,sqrt,log2,cos,sin,tan,acos,asin,atan,degrees,radians,pi,inf,comb
from itertools import accumulate,groupby,permutations,combinations,product,combinations_with_replacement
from collections import deque,defaultdict,Counter
from bisect import bisect_left,bisect_right
from operator import itemgetter
from heapq import heapify,heappop,heappush
from queue import Queue,LifoQueue,PriorityQueue
from copy import deepcopy
from time import time
from functools import reduce
import string
import sys
sys.setrecursionlimit(10 ** 7)
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

n = INT()
a = LIST()
b = [0]*n
k = 0
for i in range(n//2):
    k += a[2*i+1] - a[2*i]

b[0] = a[n-1] - k
b[n-1] = a[n-1] + k

for i in range(1, n-1):
    b[i] = 2*a[i-1] - b[i-1]
print(*b)

#!/usr/bin/env python
# coding: utf-8

# In[18]:


N = int(input())
A = list(map(int, input().split()))


# In[19]:


s = sum(A)
x = s - sum(A[1::2])*2
ans = [x]
for i in range(N-1):
    x = 2*A[i]-x
    ans += [x]
print((*ans))


# In[ ]:






import sys
input=sys.stdin.readline

n=int(input())
a=list(map(int,input().split()))

suma=sum(a)
x=[0]*n
tmp=0
for i in range(1,n,2):
    tmp+=a[i]
x[0]=suma-2*tmp

for i in range(1,n):
    x[i]=2*a[i-1]-x[i-1]
for i in x:
    print(i,end=" ")