import sys

sys.setrecursionlimit(10**9)

input = sys.stdin.readline



N = int(eval(input()))

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



sum_odd = sum([v for v in A[1::2]])

x0 = sum(A)-2*sum_odd

ans = [x0]



x = x0

for a in A:

    nex = 2*a-x

    ans.append(nex)

    x = nex

print((*ans[:-1]))

N=int(eval(input()))

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





low=0

high=10**10



#binary search the value of rain onto Mountain1

while low<=high:

    mid=(low+high)//2



    cur=mid

    for i,a in enumerate(A):

        cur=a-cur

        if cur<0:#途中で足りなくなったら、midが大きすぎ

            break

       #break

    if cur>=mid:

        low=mid+1

    else:

        if i%2==0:

            high=mid-1

        else:

            low=mid+1





ans=[]

cur=high

for a in A:

    ans.append(cur*2)

    cur=a-cur

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



import sys

sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
sum_odd = sum([v for v in A[1::2]])
x0 = sum(A) - 2 * sum_odd
ans = [x0]
x = x0
for a in A:
    nex = 2 * a - x
    ans.append(nex)
    x = nex
print((*ans[:-1]))

N = int(eval(input()))
A = list(map(int, input().split()))
low = 0
high = 10**10
# binary search the value of rain onto Mountain1
while low <= high:
    mid = (low + high) // 2
    cur = mid
    for i, a in enumerate(A):
        cur = a - cur
        if cur < 0:  # 途中で足りなくなったら、midが大きすぎ
            break
    # break
    if cur >= mid:
        low = mid + 1
    else:
        if i % 2 == 0:
            high = mid - 1
        else:
            low = mid + 1
ans = []
cur = high
for a in A:
    ans.append(cur * 2)
    cur = a - cur
print((" ".join(map(str, ans))))

-import sys - -sys.setrecursionlimit(10**9) -input = sys.stdin.readline -sum_odd = sum([v for v in A[1::2]]) -x0 = sum(A) - 2 * sum_odd -ans = [x0] -x = x0 +low = 0 +high = 10**10 +# binary search the value of rain onto Mountain1 +while low <= high: +    mid = (low + high) // 2 +    cur = mid +    for i, a in enumerate(A): +        cur = a - cur +        if cur < 0:  # 途中で足りなくなったら、midが大きすぎ +            break +    # break +    if cur >= mid: +        low = mid + 1 +    else: +        if i % 2 == 0: +            high = mid - 1 +        else: +            low = mid + 1 +ans = [] +cur = high -    nex = 2 * a - x -    ans.append(nex) -    x = nex -print((*ans[:-1])) +    ans.append(cur * 2) +    cur = a - cur +print((" ".join(map(str, ans))))