from scipy.sparse import csr_matrix

from scipy.sparse.linalg import spsolve

import numpy as np



N = int(eval(input()))

A = np.array(input().split())



rows = np.concatenate([np.arange(N), np.arange(N)])

cols = np.concatenate([np.arange(N), np.arange(1, N+1)%N])

mat = csr_matrix(([1]*(2*N), (rows, cols)), (N, N))

answer = (spsolve(mat,A) * 2 + .5).astype(int)

print((*answer))
N = int(eval(input()))

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



X = [0]*N

# 全体の和 - 偶数の和*2 = 一番目の値

# もしくは、(x/2)+(y/2)=A, ..B,..C -> x+y+z = A+B+C

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



#最初の値から順番にダムの値を引けば答え

for i in range(1, N):

  X[i] = A[i-1]*2 - X[i-1]

  

print((*X))  
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve
import numpy as np

N = int(eval(input()))
A = np.array(input().split())
rows = np.concatenate([np.arange(N), np.arange(N)])
cols = np.concatenate([np.arange(N), np.arange(1, N + 1) % N])
mat = csr_matrix(([1] * (2 * N), (rows, cols)), (N, N))
answer = (spsolve(mat, A) * 2 + 0.5).astype(int)
print((*answer))

N = int(eval(input()))
A = list(map(int, input().split()))
X = [0] * N
# 全体の和 - 偶数の和*2 = 一番目の値
# もしくは、(x/2)+(y/2)=A, ..B,..C -> x+y+z = A+B+C
X[0] = sum(A) - sum(A[1::2]) * 2
# 最初の値から順番にダムの値を引けば答え
for i in range(1, N):
    X[i] = A[i - 1] * 2 - X[i - 1]
print((*X))

-from scipy.sparse import csr_matrix -from scipy.sparse.linalg import spsolve -import numpy as np - -A = np.array(input().split()) -rows = np.concatenate([np.arange(N), np.arange(N)]) -cols = np.concatenate([np.arange(N), np.arange(1, N + 1) % N]) -mat = csr_matrix(([1] * (2 * N), (rows, cols)), (N, N)) -answer = (spsolve(mat, A) * 2 + 0.5).astype(int) -print((*answer)) +A = list(map(int, input().split())) +X = [0] * N +# 全体の和 - 偶数の和*2 = 一番目の値 +# もしくは、(x/2)+(y/2)=A, ..B,..C -> x+y+z = A+B+C +X[0] = sum(A) - sum(A[1::2]) * 2 +# 最初の値から順番にダムの値を引けば答え +for i in range(1, N): +    X[i] = A[i - 1] * 2 - X[i - 1] +print((*X))