import numpy as np

from scipy.sparse import csr_matrix,linalg

import itertools

n = int(eval(input()))

b = np.array([int(i) for i in input().split()])

rows = []

cols = []

for i in range(n):

    rows.append(i%n)

    rows.append(i%n)

    cols.append(i%n)

    cols.append((i+1)%n)



A = csr_matrix((np.ones(n*2,dtype=np.int32),(rows,cols)),(n,n))

x = linalg.spsolve(A,b)

print((*(int(i) for i in 2*x)))
n = int(eval(input()))

a = [int(i) for i in input().split()]

s = sum(a)

x = [0] * n



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

for i in range(n-1):

    x[i+1] = (2 * a[i] - x[i])



print((*x))
import numpy as np
from scipy.sparse import csr_matrix, linalg
import itertools

n = int(eval(input()))
b = np.array([int(i) for i in input().split()])
rows = []
cols = []
for i in range(n):
    rows.append(i % n)
    rows.append(i % n)
    cols.append(i % n)
    cols.append((i + 1) % n)
A = csr_matrix((np.ones(n * 2, dtype=np.int32), (rows, cols)), (n, n))
x = linalg.spsolve(A, b)
print((*(int(i) for i in 2 * x)))

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

-import numpy as np -from scipy.sparse import csr_matrix, linalg -import itertools - -b = np.array([int(i) for i in input().split()]) -rows = [] -cols = [] -for i in range(n): -    rows.append(i % n) -    rows.append(i % n) -    cols.append(i % n) -    cols.append((i + 1) % n) -A = csr_matrix((np.ones(n * 2, dtype=np.int32), (rows, cols)), (n, n)) -x = linalg.spsolve(A, b) -print((*(int(i) for i in 2 * x))) +a = [int(i) for i in input().split()] +s = sum(a) +x = [0] * n +x[0] = s - 2 * sum((a[i] for i in range(1, n, 2))) +for i in range(n - 1): +    x[i + 1] = 2 * a[i] - x[i] +print((*x))