import os

import sys



if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")



sys.setrecursionlimit(2147483647)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7



N = int(sys.stdin.readline())

A = list(map(int, sys.stdin.readline().split()))





def bisect_left_callable(fn, x, lo, hi):

    """

    (memo) いっぱい呼ぶなら np.searchsorted のほうがベクトル化されててはやそう

    lo から hi-1 のうち、fn の結果が x 以上となる、最も左の値

    bisect.bisect_left と同じ

    https://docs.python.org/ja/3/library/bisect.html

    :param callable fn:

    :param x:

    :param int lo: 最小値

    :param int hi: 最大値 + 1

    :return: lo <= ret <= hi

    """

    while lo < hi:

        mid = (lo + hi) // 2

        if fn(mid) < x:

            lo = mid + 1

        else:

            hi = mid

    return lo





def solve(n, a=False):

    mts = A.copy()

    mts[0] -= n

    mts[-1] -= n

    hist = [n*2]

    for i in range(N):

        mts[(i + 1) % N] -= mts[i]

        hist.append(mts[i] * 2)

    if a:

        return hist

    else:

        return -mts[-1]





n = bisect_left_callable(solve, 0, 0, A[0] + 1)

print((*solve(n, True)[:-1]))

import os

import sys



if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")



sys.setrecursionlimit(2147483647)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7



N = int(sys.stdin.readline())

A = list(map(int, sys.stdin.readline().split()))



S = sum(A)

ans = [0] * N

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

for i in range(1, N):

    ans[i] = (A[i - 1] - ans[i - 1] // 2) * 2

print((*ans))

import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))


def bisect_left_callable(fn, x, lo, hi):
    """
    (memo) いっぱい呼ぶなら np.searchsorted のほうがベクトル化されててはやそう
    lo から hi-1 のうち、fn の結果が x 以上となる、最も左の値
    bisect.bisect_left と同じ
    https://docs.python.org/ja/3/library/bisect.html
    :param callable fn:
    :param x:
    :param int lo: 最小値
    :param int hi: 最大値 + 1
    :return: lo <= ret <= hi
    """
    while lo < hi:
        mid = (lo + hi) // 2
        if fn(mid) < x:
            lo = mid + 1
        else:
            hi = mid
    return lo


def solve(n, a=False):
    mts = A.copy()
    mts[0] -= n
    mts[-1] -= n
    hist = [n * 2]
    for i in range(N):
        mts[(i + 1) % N] -= mts[i]
        hist.append(mts[i] * 2)
    if a:
        return hist
    else:
        return -mts[-1]


n = bisect_left_callable(solve, 0, 0, A[0] + 1)
print((*solve(n, True)[:-1]))

import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))
S = sum(A)
ans = [0] * N
ans[0] = S - sum(A[1::2]) * 2
for i in range(1, N):
    ans[i] = (A[i - 1] - ans[i - 1] // 2) * 2
print((*ans))

- - -def bisect_left_callable(fn, x, lo, hi): -    """ -    (memo) いっぱい呼ぶなら np.searchsorted のほうがベクトル化されててはやそう -    lo から hi-1 のうち、fn の結果が x 以上となる、最も左の値 -    bisect.bisect_left と同じ -    https://docs.python.org/ja/3/library/bisect.html -    :param callable fn: -    :param x: -    :param int lo: 最小値 -    :param int hi: 最大値 + 1 -    :return: lo <= ret <= hi -    """ -    while lo < hi: -        mid = (lo + hi) // 2 -        if fn(mid) < x: -            lo = mid + 1 -        else: -            hi = mid -    return lo - - -def solve(n, a=False): -    mts = A.copy() -    mts[0] -= n -    mts[-1] -= n -    hist = [n * 2] -    for i in range(N): -        mts[(i + 1) % N] -= mts[i] -        hist.append(mts[i] * 2) -    if a: -        return hist -    else: -        return -mts[-1] - - -n = bisect_left_callable(solve, 0, 0, A[0] + 1) -print((*solve(n, True)[:-1])) +S = sum(A) +ans = [0] * N +ans[0] = S - sum(A[1::2]) * 2 +for i in range(1, N): +    ans[i] = (A[i - 1] - ans[i - 1] // 2) * 2 +print((*ans))