import numpy as np

from scipy.sparse import csr_matrix

from scipy.sparse.linalg import spsolve



N = int(input())

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

r, c, v = [None] * 2 * N, [None] * 2 * N, [None] * 2 * N

for n in range(N):

  r[2 * n] = n

  r[2 * n + 1] = n

  c[2 * n] = n

  c[2 * n + 1] = n + 1 if n != N - 1 else 0

  v[2 * n] = 1

  v[2 * n + 1] = 1

C = csr_matrix((v, (r, c)), shape=(N, N))

a = list(map(int, spsolve(C, A)))

for aa in a:

  print(aa, end=' ')

N = int(eval(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))))
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve

N = int(input())
A = 2 * np.array(list(map(int, input().split())))
r, c, v = [None] * 2 * N, [None] * 2 * N, [None] * 2 * N
for n in range(N):
    r[2 * n] = n
    r[2 * n + 1] = n
    c[2 * n] = n
    c[2 * n + 1] = n + 1 if n != N - 1 else 0
    v[2 * n] = 1
    v[2 * n + 1] = 1
C = csr_matrix((v, (r, c)), shape=(N, N))
a = list(map(int, spsolve(C, A)))
for aa in a:
    print(aa, end=" ")

N = int(eval(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))))

-import numpy as np -from scipy.sparse import csr_matrix -from scipy.sparse.linalg import spsolve - -N = int(input()) -A = 2 * np.array(list(map(int, input().split()))) -r, c, v = [None] * 2 * N, [None] * 2 * N, [None] * 2 * N -for n in range(N): -    r[2 * n] = n -    r[2 * n + 1] = n -    c[2 * n] = n -    c[2 * n + 1] = n + 1 if n != N - 1 else 0 -    v[2 * n] = 1 -    v[2 * n + 1] = 1 -C = csr_matrix((v, (r, c)), shape=(N, N)) -a = list(map(int, spsolve(C, A))) -for aa in a: -    print(aa, end=" ") +N = int(eval(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))))