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: MEDIUM_HARD

Solutions:
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()))
S = sum(A)
B = [0] * N
B[0] = S - 2 * sum(A[1::2])
for i in range(N - 1):
	B[i + 1] = 2 * A[i] - B[i]
print(*B)


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


n = int(input())
a = list(map(int, input().split()))
ai = a[0::2]
aii = a[1::2]
tmp = sum(ai) - sum(aii)
print(tmp, end=' ')
for i in range(1, n):
	tmp = -tmp + 2 * a[i - 1]
	print(tmp, end=' ')


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


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)


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


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()


def main():
	import sys
	input = lambda : sys.stdin.readline().strip()
	N = int(input())
	A = list(map(int, input().split()))
	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 = 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)


(_, *l) = map(int, open(0).read().split())
a = []
t = sum(l) - sum(l[1::2]) * 2
for i in l:
	a += [t]
	t = i * 2 - t
print(*a)


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)))


n = int(input())
(*A,) = map(int, input().split())
X = []
p = sum(A[::2])
q = sum(A[1::2])
for a in A:
	X += [p - q]
	(p, q) = (q + a, p - a)
print(*X)


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


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,) = map(int, input().split())
ans = []
x = sum(((-1) ** i * j for (i, j) in enumerate(A)))
ans.append(x)
for i in A[:-1]:
	x = i * 2 - x
	ans.append(x)
print(*ans)


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)


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)))


N = int(input())
A = list(map(int, input().split()))
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=' ')


from itertools import *
(n, *b) = map(int, open(0).read().split())
a1 = sum((b[i] * (-1) ** (i % 2) for i in range(n)))
l = [a1]
for i in range(n - 1):
	l.append((b[i] - l[-1] // 2) * 2)
print(*l)


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


n = int(input())
a = [int(i) for i in input().split()]
b = 0
c = 1
for i in a:
	b += i * c
	c *= -1
ans = [b]
for i in a:
	ans.append(2 * i - ans[-1])
print(*ans[:-1])


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


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()))
ans = 0
for i in range(N):
	ans += A[i] * (-1) ** (i % 2)
B = [0] * N
for i in range(N):
	B[i] = ans
	ans *= -1
	ans += A[i] * 2
print(*B)


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 = 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()))
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='')


N = int(input())
A = [int(i) for i in input().split()]
p = 0
for a in A:
	p = a * 2 - p
ans = [p // 2]
for a in A[:-1]:
	ans.append(a * 2 - ans[-1])
print(*ans)


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()))
b = [0] * n
sum_r = sum(a)
tmp = 0
for i in range(n // 2 + 1):
	tmp += a[i * 2] * 2
b[0] = tmp - sum_r
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()))
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()))
a0 = sum(a) // 2 - sum(a[1::2])
ans = [a0 * 2]
for i in range(n - 2):
	ans.append(a[i] * 2 - ans[-1])
ans.append((a[-1] - a0) * 2)
print(*ans)


(n, *a) = map(int, open(0).read().split())
b = [0] * n
b[0] = sum(a) - 2 * sum(a[1::2])
for i in range(n - 1):
	b[i + 1] = 2 * a[i] - b[i]
print(*b)


N = int(input())
A = list(map(int, input().split(' ')))
x = sum(A[::2]) - sum(A[1::2])
l = [x]
for i in range(N - 1):
	m = (A[i] - l[-1] // 2) * 2
	l.append(m)
print(*l)


N = int(input())
l_a = list(map(int, input().split()))
b_x = sum(l_a) - sum(l_a[1::2]) * 2
l_x = [b_x]
for s in range(N - 1):
	x = l_a[s] * 2 - b_x
	l_x.append(x)
	b_x = x
print(*l_x)


N = int(input())
A = list(map(int, input().split()))
x = sum(A) - 2 * sum(A[1::2])
print(x, '', end='')
for a in A[:-1]:
	x = 2 * a - x
	print(x, '', end='')


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


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 = [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()))
M = []
M.append(sum(A[0::2]) - sum(A[1::2]))
for i in range(1, N):
	M.append(-M[i - 1] + A[i - 1] * 2)
print(' '.join(map(str, M)))


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


N = int(input())
L = list(map(int, input().split()))
a = L[0]
for i in range(N - 1):
	a = L[i + 1] - a
R = [0] * N
R[0] = a
for i in range(N - 1):
	R[i + 1] = (L[i] - R[i] // 2) * 2
print(' '.join(list(map(str, R))))


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


n = int(input())
a = list(map(int, input().split()))
s = sum(a) // 2
m = s - sum(a[1::2])
print(m * 2, end=' ')
for i in range(n - 1):
	m = a[i] - m
	print(m * 2, end=' ')


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


n = int(input())
a = list(map(int, input().split()))
s = sum(a)
ans = [0 for i in range(n)]
s2 = sum(a[1::2])
x0 = s - s2 * 2
ans[0] = x0
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()))
cnt = 0
for i in range(n):
	cnt = A[i] - cnt
B = [cnt]
cnt = cnt // 2
for i in range(n - 1):
	cnt = A[i] - cnt
	B.append(cnt * 2)
print(*B)


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


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


(_, a) = open(0)
(*a,) = map(int, a.split())
t = sum(a) - 2 * sum(a[1::2])
x = [t]
for i in a:
	t = i * 2 - t
	x += (t,)
print(*x[:-1])


n = int(input())
ms = list(map(int, input().split()))
a = sum(ms) - 2 * sum(ms[1::2])
vv = ['%d' % a]
for m in ms[:-1]:
	a = 2 * m - a
	vv.append('%d' % a)
print(' '.join(vv))


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


input()
l = list(map(int, input().split()))
a = []
t = sum(l) - sum(l[1::2]) * 2
for i in l:
	a += [t]
	t = i * 2 - t
print(*a)


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 = [int(i) for i in input().split()]
b = sum(a) // 2
c = [0] * n
c[-1] = b - sum(a[:-1:2])
for i in range(n - 1, 0, -1):
	c[i - 1] = a[i - 1] - c[i]
print(' '.join([str(i * 2) for i in c]))


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


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


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


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


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


N = int(input())
A = [int(c) for c in input().split()]
X = [None] * N
X[0] = sum(A) - sum(A[1::2]) * 2
for i in range(N - 1):
	X[i + 1] = 2 * A[i] - X[i]
print(' '.join([str(x) for x in X]))


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


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


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


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())
arr = list(map(int, input().split()))
a = sum(arr) // 2
for i in range(1, n, 2):
	a -= arr[i]
print(a * 2, end=' ')
for i in range(0, n - 1):
	print((arr[i] - a) * 2, end=' ')
	a = arr[i] - a


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


N = int(input())
a = [int(i) for i in input().split()]
li = [0] * N
li[0] = sum(a[::2]) - sum(a[1::2])
for i in range(1, N):
	li[i] = 2 * a[i - 1] - li[i - 1]
print(*li)


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)


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())
a = [int(i) for i in input().split()]
dp = [0 for i in range(n)]
dp[0] = sum(a) - 2 * sum(a[1::2])
for i in range(1, n):
	dp[i] = 2 * a[i - 1] - dp[i - 1]
print(' '.join(map(str, dp)))


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)


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


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]))


N = int(input())
a = list(map(int, input().split()))
k = 4 * sum(a[1::2])
l = 2 * sum(a)
r = [0] * N
r[0] = (l - k) // 2
for i in range(1, N):
	r[i] = 2 * a[i - 1] - r[i - 1]
print(*r)


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())
(*A,) = map(int, input().split())
X = [0] * N
total = sum(A)
X[0] = total - 2 * sum([a for a in 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()))
x = [0] * n
S = sum(A)
A2 = A[1::2]
x[0] = S - 2 * sum(A2)
for i in range(n - 1):
	x[i + 1] = 2 * A[i] - x[i]
print(*x)


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))


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, *a) = 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])


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


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()))
e = sum(A[::2])
o = sum(A[1::2])
ans = [e - o]
for a in A:
	ans.append(2 * (a - ans[-1] // 2))
ans.pop()
print(*ans)


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()))
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)


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 = [int(i) for i in input().split()]
ANS = [sum(A) - 2 * sum(A[1::2])]
for i in range(N - 1):
	ANS.append(2 * A[i] - ANS[-1])
print(*ANS)


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)


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()))
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())
ais = list(map(int, input().split()))
xs = [0] * n
s = sum(ais)
xs[0] = s - 2 * sum(ais[1::2])
for i in range(1, n):
	xs[i] = 2 * ais[i - 1] - xs[i - 1]
print(*xs)


n = int(input())
A = list(map(int, input().split()))
s = sum(A)
t = 0
Ans = [0] * n
for i in range(1, n, 2):
	t += A[i] * 2
Ans[0] = s - t
for i in range(1, n):
	Ans[i] = A[i - 1] * 2 - 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 = [int(x) for x in input().rstrip().split()]
x1 = sum(a) - 2 * sum([a[i] for i in range(1, n - 1, 2)])
x = [x1]
for i in range(1, n):
	x.append(2 * a[i - 1] - x[i - 1])
print(*x)


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


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 = list(map(int, input().split()))
t = [0] * N
t[0] = sum(A[::2]) - sum(A[1::2])
for i in range(1, N):
	t[i] = 2 * A[i - 1] - t[i - 1]
print(*[str(i) for i in t])


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


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=' ')


input()
a = [int(x) for x in input().split()]
b = sum(a) - 2 * sum(a[1::2])
ans = [b]
for x in a:
	b = x * 2 - b
	ans.append(b)
print(*ans[:-1])


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


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()


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()


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


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


n = int(input())
ls = list(map(int, input().split()))
t = sum(ls) - 2 * sum(ls[1::2])
x = [t]
for i in ls:
	t = i * 2 - t
	x.append(t)
x.pop()
print(*x)


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


n = int(input())
a_list = list(map(int, input().split()))
x = sum(a_list[::2]) - sum(a_list) // 2
ans = []
for a in a_list:
	ans.append(str(x * 2))
	x = a - x
print(' '.join(ans))


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


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()))
X = [0] * n
s = 0
for i in range(n):
	s += (-1) ** i * A[i]
X[0] = s // 2
for i in range(n - 1):
	X[i + 1] = A[i] - X[i]
print(*[2 * x for x in X])


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]))


a = int(input())
b = list(map(int, input().split()))
c = sum(b[::2]) - sum(b[1::2])
d = [c]
for i in b:
	d.append(2 * i - c)
	c = 2 * i - c
d.pop()
print(*d)


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()))
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)


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


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


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()))
s = sum(a) - sum(a[1::2]) * 2
d = [s]
for i in range(n):
	if i != n - 1:
		d.append((a[i] - s // 2) * 2)
		s = (a[i] - s // 2) * 2
print(*d)


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)


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()))
x1 = sum(A[0::2]) - sum(A[1::2])
Ans = [x1]
for a in A:
	Ans.append(2 * a - Ans[-1])
print(*Ans[:-1], sep=' ')


n = int(input())
a = list(map(int, input().split()))
b = []
b.append(sum(a) - 2 * sum(a[1:n - 1:2]))
i = 0
while i < n - 1:
	b.append(2 * a[i] - b[i])
	i += 1
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)))


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()
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())
a = [int(_) * 2 for _ in input().split()]
s = sum(a) // 2
ss = sum(a[1::2])
x = [0 for _ in range(n)]
x[0] = s - ss
for i in range(1, n):
	x[i] = a[i - 1] - x[i - 1]
print(*x)


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 = [int(_) for _ in input().split()]
ans = [0] * N
ans[0] = sum(A) // 2 - sum(A[1::2])
for i in range(N - 1):
	ans[i + 1] = A[i] - ans[i]
print(' '.join((str(2 * a) for a in ans)))


N = int(input())
X = list(map(int, input().split()))
Y = [0] * N
S = sum(X)
Y[0] = S - 2 * sum([X[i] for i in range(N) if i % 2 == 1])
for i in range(N - 1):
	Y[i + 1] = 2 * X[i] - Y[i]
print(*Y)


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])


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=' ')


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


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)


n = int(input())
A = list(map(int, input().split()))
M = [0] * n
M[0] = sum((A[i] if i % 2 == 0 else -A[i] for i in range(n)))
for i in range(1, n):
	M[i] = 2 * A[i - 1] - M[i - 1]
print(*M)


N = int(input())
A = list(map(int, input().split()))
X = [None] * N
X[0] = sum(A) - 2 * sum(A[1::2])
for n in range(1, N):
	X[n] = 2 * A[n - 1] - X[n - 1]
print(' '.join(map(str, X)))


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)))