For an array of non-negative integers $a$ of size $n$, we construct another array $d$ as follows: $d_1 = a_1$, $d_i = |a_i - a_{i - 1}|$ for $2 \le i \le n$.

Your task is to restore the array $a$ from a given array $d$, or to report that there are multiple possible arrays.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 100$) — the number of test cases.

The first line of each test case contains one integer $n$ ($1 \le n \le 100$) — the size of the arrays $a$ and $d$.

The second line contains $n$ integers $d_1, d_2, \dots, d_n$ ($0 \le d_i \le 100$) — the elements of the array $d$.

It can be shown that there always exists at least one suitable array $a$ under these constraints.


-----Output-----

For each test case, print the elements of the array $a$, if there is only one possible array $a$. Otherwise, print $-1$.


-----Examples-----

Input
3
4
1 0 2 5
3
2 6 3
5
0 0 0 0 0
Output
1 1 3 8
-1
0 0 0 0 0


-----Note-----

In the second example, there are two suitable arrays: $[2, 8, 5]$ and $[2, 8, 11]$.

Difficulty: EASY

Solutions:
t = int(input())
for _ in range(t):
	n = int(input())
	ds = input().split()
	ds = [int(d) for d in ds]
	is_weiyi = True
	arr = [ds[0]]
	for d in ds[1:]:
		if d > 0 and d <= arr[-1]:
			is_weiyi = False
			break
		arr.append(arr[-1] + d)
	if is_weiyi:
		print(' '.join([str(i) for i in arr]))
	else:
		print(-1)


def test():
	input()
	b = list(map(int, input().split()))
	a = [b[0]]
	for x in b[1:]:
		if x <= a[-1] and x != 0:
			print(-1)
			return
		else:
			a += [a[-1] + x]
	print(' '.join(map(str, a)))
t = int(input())
for _ in range(t):
	test()


t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, input().split()))
	d = [arr[0]]
	valid = True
	for i in range(1, n):
		if d[-1] >= arr[i] and arr[i] > 0:
			valid = False
			break
		d.append(d[-1] + arr[i])
	if valid:
		print(*d)
	else:
		print(-1)


t = int(input())
for _ in range(t):
	n = int(input())
	d = list(map(int, input().split()))
	ans = [d[0]]
	f = 1
	for i in range(1, n):
		if ans[i - 1] - d[i] >= 0:
			if d[i] != 0:
				f = 0
				break
			else:
				ans.append(ans[i - 1] + d[i])
		else:
			ans.append(ans[i - 1] + d[i])
	if f:
		print(*ans)
	else:
		print(-1)


from math import *
for z in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	ans = [str(d[0])]
	for i in range(1, n):
		if d[i] != 0:
			if d[i] <= int(ans[-1]):
				print(-1)
				break
		ans.append(str(int(ans[-1]) + d[i]))
	else:
		print(' '.join(ans))


t = int(input())
for ttt in range(t):
	n = int(input())
	d = [int(i) for i in input().split()]
	ans = [str(d[0])]
	for i in range(1, n):
		l = int(ans[-1])
		if l < d[i] or d[i] == 0:
			ans.append(str(l + d[i]))
		else:
			print(-1)
			break
	else:
		print(' '.join(ans))


t = int(input())

def solve():
	n = int(input())
	a = list(map(int, input().split()))
	s = 0
	res = []
	for i in a:
		if s >= i and i:
			print(-1)
			return
		s += i
		res.append(s)
	print(' '.join(map(str, res)))
for i in range(t):
	solve()


for _ in range(int(input())):
	n = int(input())
	lis = list(map(int, input().split()))
	num = [lis[0]]
	flag = False
	for i in range(1, n):
		if lis[i] == 0:
			num.append(num[-1])
		elif num[-1] - lis[i] >= 0:
			flag = True
			break
		else:
			num.append(num[-1] + lis[i])
	if flag:
		print(-1)
	else:
		print(*num)


for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	a = []
	a.append(d[0])
	for i in range(1, n):
		x = d[i]
		y = -1 * x + a[-1]
		z = 1 * x + a[-1]
		if y >= 0 and z >= 0 and (y != z):
			break
		a.append(max(y, z))
	if len(a) == n:
		print(*a)
	else:
		print(-1)


import sys
readline = sys.stdin.readline
T = int(readline())
for _ in range(T):
	N = int(readline())
	S = list(map(int, readline().split()))
	A = [S[0]]
	for i in range(1, N):
		s = S[i]
		a = A[i - 1]
		tmp = sorted({s + a, -s + a})
		if len(tmp) == 1 or tmp[0] < 0:
			A.append(tmp[-1])
		else:
			print(-1)
			break
	else:
		print(*A)


import sys
sys.setrecursionlimit(1000000)

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def si():
	return str(input())

def ni():
	return int(input())

def check(n, m, x, y):
	return x - 2 >= 1 and y - 1 >= 1 or (y - 2 >= 1 and x - 1 >= 1) or (x - 2 >= 1 and y + 1 <= m) or (y - 2 >= 1 and x + 1 <= n) or (x + 2 <= n and y - 1 >= 1) or (y + 2 <= m and x - 1 >= 1) or (x + 2 <= n and y + 1 <= m) or (y + 2 <= m and x + 1 <= n)
for T in range(int(input())):
	n = ni()
	d = li()
	flag = True
	ans = [d[0]]
	for i in range(1, n):
		if ans[-1] + d[i] >= 0 and ans[-1] - d[i] >= 0 and (ans[-1] + d[i] != ans[-1] - d[i]):
			print(-1)
			flag = False
			break
		ans.append(d[i] + ans[-1])
	if flag:
		print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	D = list(map(int, input().split()))
	A = []
	A.append(D[0])
	for i in range(1, n):
		if D[i] != 0 and A[i - 1] - D[i] >= 0:
			A = -1
			break
		else:
			A.append(A[i - 1] + D[i])
	if A == -1:
		print(A)
	else:
		for i in range(n):
			if i == n - 1:
				print(A[i])
			else:
				print(A[i], end=' ')


t = int(input())
for i in range(t):
	n = int(input())
	d = list(map(int, input().split()))
	ans = []
	s = d[0]
	ans.append(s)
	c = 0
	for i in range(1, n):
		x = s + d[i]
		y = s - d[i]
		if x >= 0 and y >= 0 and (x != y):
			c = -1
			break
		else:
			s = max(x, y)
			ans.append(s)
	if c == -1:
		print(-1)
	else:
		print(*ans)


def loop(s, d, n):
	ans = [s]
	for i in range(1, n):
		if d[i] and s - d[i] >= 0:
			return [-1]
		s += d[i]
		ans.append(s)
	return ans
for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	s = d[0]
	ans = loop(s, d, n)
	print(*ans, sep=' ')


for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	a = [d[0]]
	result = 0
	for i in range(1, n):
		(x, y) = (a[i - 1] + d[i], a[i - 1] - d[i])
		if x * y < 0 or x == y:
			a.append(max(x, y))
		else:
			result = -1
			break
	if result == -1:
		print(-1)
	else:
		print(*a)


for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	a = []
	if d.count(0) == n:
		print(*d)
	else:
		for i in range(0, n):
			if i == 0:
				a.append(d[i])
			elif a[i - 1] < d[i]:
				a.append(a[i - 1] + d[i])
			elif d[i] == 0:
				a.append(a[i - 1])
			elif a[i - 1] >= d[i]:
				print(-1)
				break
		if len(a) == n:
			print(*a)


testcases = int(input())
for i in range(testcases):
	n = int(input())
	d = list(map(int, input().split()))
	a = []
	a.append(d[0])
	for j in range(1, n):
		if d[j] == 0 or a[j - 1] < d[j]:
			a.append(d[j] + a[j - 1])
		else:
			break
	if len(a) == len(d):
		print(*a)
	else:
		print(-1)


for Pythonic__Python in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	ans = [l[0]]
	for i in range(n - 1):
		if ans[i] - l[i + 1] >= 0 and l[i + 1] != 0:
			ans = [-1]
			break
		else:
			ans.append(ans[i] + l[i + 1])
	print(*ans)


import sys
t = int(sys.stdin.readline())

def solve():
	n = int(sys.stdin.readline())
	d = list(map(int, sys.stdin.readline().split()))
	a = [d[0]]
	for i in d[1:]:
		x = a[-1] + i
		y = a[-1] - i
		if x < 0 and y < 0:
			break
		elif x >= 0 and x == y:
			a.append(x)
		elif x >= 0 and y >= 0:
			break
		else:
			a.append(x if x >= 0 else y)
	if len(a) == n:
		print(*a)
	else:
		print(-1)
for _ in range(t):
	solve()


T = int(input())
for _ in range(T):
	_ = input()
	arr = list(map(int, input().split()))
	val = arr[0]
	ans = [val]
	for n in arr[1:]:
		if n != 0 and val - n >= 0:
			print(-1)
			break
		val += n
		ans.append(val)
	else:
		print(*ans)


def recover(d):
	a = []
	for i in range(len(d)):
		if i == 0:
			a.append(d[i])
		else:
			a1 = d[i] + a[i - 1]
			a2 = -d[i] + a[i - 1]
			if a1 >= 0 and a2 >= 0 and (not a1 == a2):
				return -1
			elif a1 >= 0:
				a.append(a1)
			elif a2 >= 0:
				a.append(a2)
			else:
				return -1
	return a
l = []
n = int(input())
o = []
for _ in range(n):
	a = int(input())
	l.append(list(map(int, input().split())))
for d in l:
	o.append(recover(d))
for i in o:
	if i == -1:
		print(-1)
		continue
	print(' '.join(map(str, i)))


t = int(input())
for i in range(t):
	n = int(input())
	m = list(map(int, input().split()))
	ans = 0
	for i in range(n - 1):
		if m[i + 1] <= m[i] and m[i + 1] != 0:
			ans -= 1
			break
		else:
			m[i + 1] = abs(m[i + 1] + m[i])
	if ans == -1:
		print(ans)
	else:
		print(*m)


t = int(input())
for i in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	ans = [a[0]]
	for i in range(1, len(a)):
		if a[i] + ans[-1] >= 0 and (a[i] <= ans[-1] and a[i] != 0):
			ans = -1
			break
		else:
			ans.append(a[i] + ans[-1])
	if ans == -1:
		print(ans)
	else:
		print(' '.join([str(i) for i in ans]))


t = int(input())
for i in range(t):
	a = int(input())
	b = list(map(int, input().split()))
	c = []
	c.append(str(b[0]))
	for i in range(len(b) - 1):
		if b[i + 1] != 0 and int(c[len(c) - 1]) - b[i + 1] >= 0:
			print('-1')
			break
		else:
			c.append(str(int(c[len(c) - 1]) + b[i + 1]))
	if len(c) == a:
		print(' '.join(c))


t = int(input())
for i in range(t):
	n = int(input())
	d = [int(_) for _ in input().split(' ')]
	arr = [d[0]]
	isError = False
	for i in range(1, n):
		if d[i] != 0 and d[i] + arr[-1] >= 0 and (arr[-1] - d[i] >= 0):
			isError = True
			break
		arr.append(d[i] + arr[-1])
	if isError:
		print(-1)
	else:
		print(*arr)


t = int(input())
for i in range(t):
	size = int(input())
	d = list(map(int, input().split()))
	s = [d[0]]
	c = 1
	for i in range(0, size - 1):
		x1 = s[i] + d[i + 1]
		x2 = s[i] - d[i + 1]
		if x1 >= 0 and x2 >= 0:
			if x1 == x2:
				s.append(x1)
			else:
				print(-1)
				c -= 1
				break
		elif x1 >= 0:
			s.append(x1)
		elif x2 >= 0:
			s.append(x2)
	if c == 1:
		print(*s)


for i in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	ans = 0
	val = [0] * 1000
	for i in range(n):
		val[i + 1] = d[i]
	for k in range(1, n):
		if val[k + 1] <= val[k] and val[k + 1] != 0:
			ans = -1
			break
		else:
			val[k + 1] = abs(val[k] + val[k + 1])
	if ans == -1:
		print(ans)
	else:
		print(*val[1:n + 1])


for s in [*open(0)][2::2]:
	r = []
	t = f = 0
	for x in map(int, s.split()):
		f |= 0 < x <= t
		t += x
		r += (t,)
	print(*(r, [-1])[f])


tescase = int(input())
arrays = []
sizes = []
for i in range(tescase):
	sizes.append(int(input()))
	inp = input().split()
	ar = [int(i) for i in inp]
	arrays.append(ar)

def restore(array):
	newarr = [array[0]]
	for i in array[1:]:
		el1 = newarr[-1] + i
		el2 = newarr[-1] - i
		if el1 >= 0 and el2 >= 0 and (el1 != el2):
			return -1
		if el2 >= 0:
			newarr.append(el2)
		else:
			newarr.append(el1)
	return newarr
for array in arrays:
	res = restore(array)
	if res == -1:
		print(res)
	else:
		print(*res)


for _ in range(int(input())):
	n = int(input())
	num = list(map(int, input().split()))
	ans = [num[0]]
	f = 1
	for i in range(1, n):
		x = ans[i - 1] + num[i]
		y = ans[i - 1] - num[i]
		if y < 0:
			y = x
		if y >= 0 and y != x:
			f = 0
			break
		ans.append(x)
	if f == 0:
		print(-1)
	else:
		print(*ans)


for _ in range(int(input().strip())):
	n = int(input())
	l = list(map(int, input().split()))
	l2 = [l[0]]
	c = 1
	for i in range(1, n):
		if l2[i - 1] + l[i] >= 0 and l2[i - 1] - l[i] >= 0 and (l[i] != 0):
			c = 0
			break
		l2.append(l2[i - 1] + l[i])
	if c:
		print(*l2)
	else:
		print(-1)


def int_input():
	a = int(input())
	return a

def int_list_input():
	a = list(map(int, input().split()))
	return a

def solve():
	n = int_input()
	d = int_list_input()
	ans = [i for i in d]
	for i in range(1, n):
		y = ans[i - 1] - d[i]
		x = ans[i - 1] + d[i]
		if x >= 0 and y >= 0 and (x != y):
			print(-1)
			return
		ans[i] = max(ans[i - 1] + d[i], ans[i - 1] - d[i])
	print(*ans)
for _ in range(int(input())):
	solve()


for __ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	a = [0] * n
	a[0] = d[0]
	ans = True
	for i in range(1, n):
		if a[i - 1] - d[i] >= 0 and a[i - 1] - d[i] != d[i] + a[i - 1]:
			ans = False
		else:
			a[i] = d[i] + a[i - 1]
	if ans:
		print(*a)
	else:
		print(-1)


t = int(input())
for _ in range(0, t):
	n = int(input())
	list1 = [int(num) for num in input().split()]
	list2 = []
	list2.append(list1[0])
	c = 0
	for i in range(1, n):
		if list1[i] == 0:
			list2.append(list2[i - 1])
		elif list2[i - 1] < list1[i]:
			list2.append(list1[i] + list2[i - 1])
		else:
			c = 1
			break
	if c == 1:
		print(-1)
	else:
		print(*list2)


for _ in range(int(input())):
	n = int(input())
	a = list(map(int, input().split()))
	b = [a[0]]
	flag = True
	for i in range(1, n):
		if a[i] <= b[i - 1] and a[i] != 0:
			flag = False
			break
		else:
			b.append(b[i - 1] + a[i])
	if flag == False:
		print(-1)
	else:
		print(*b)


for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	f = 1
	a = [d[0]]
	for i in range(n - 1):
		if d[i + 1] > 0 and d[i + 1] <= a[-1]:
			f = 0
			break
		a.append(a[-1] + d[i + 1])
	if not f:
		print(-1)
	else:
		print(*a)


for _ in range(int(input())):
	n = int(input())
	l = list(map(int, input().split()))
	i = l[0]
	h = False
	l1 = [l[0]]
	for j in l[1:]:
		if j <= i and j != 0:
			h = True
			break
		else:
			l1.append(j + i)
			i += j
	if h:
		print(-1)
	else:
		print(*l1)


for _ in range(int(input())):
	n = int(input())
	ans = [0]
	for x in map(int, input().split()):
		if x != 0 and ans[-1] - x >= 0:
			print(-1)
			break
		else:
			ans.append(ans[-1] + x)
	else:
		print(*ans[1:])


t = eval(input())
for i in range(t):
	n = eval(input())
	d = list(map(int, input().split()))
	p = 0
	c = []
	a1 = d[0]
	c.append(a1)
	for i in range(1, n):
		if (a1 - d[i]) * (a1 + d[i]) >= 0 and d[i] != 0:
			print(-1)
			p = 1
			break
		else:
			c.append(max(a1 - d[i], a1 + d[i]))
			a1 = c[-1]
	if p == 0:
		print(*c)


for i in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	a = [d[0]]
	for j in range(1, n):
		if d[j] + a[j - 1] < 0 or (a[j - 1] - d[j] >= 0 and a[j - 1] - d[j] != d[j] + a[j - 1]):
			print(-1)
			break
		a.append(d[j] + a[j - 1])
	else:
		print(*a, sep=' ')


tc = int(input())
for i in range(tc):
	n = int(input())
	d = [int(x) for x in input().split()]
	a = [d[0]]
	for v in d[1:]:
		if v != 0 and a[-1] >= v:
			print(-1)
			break
		else:
			a.append(v + a[-1])
	else:
		print(*a)


t = int(input())
for ind in range(t):
	n = int(input())
	d = list(map(int, input().strip().split()))[:n]
	a = [d[0]]
	boolean = True
	for i in range(1, n):
		if a[i - 1] - d[i] >= 0 and d[i] != 0:
			boolean = False
			break
		else:
			a.append(d[i] + a[i - 1])
	if boolean:
		print(*a)
	else:
		print(-1)


for i in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	a = []
	for j in range(n):
		if j == 0:
			a.append(d[j])
		elif a[j - 1] >= d[j] and d[j] != 0:
			print(-1)
			break
		else:
			a.append(a[j - 1] + d[j])
	if len(a) == n:
		print(*a)


tq = int(input())
for i in range(tq):
	n = int(input())
	d = list(map(int, input().split()))
	a = [0] * n
	a[0] = d[0]
	count = 0
	for j in range(1, n):
		q = d[j] + a[j - 1]
		qr = -d[j] + a[j - 1]
		if q >= 0 and qr >= 0 and (q != qr):
			count = 1
			break
		if q >= 0 and qr < 0:
			a[j] = q
		if q < 0 and qr >= 0:
			a[j] = qr
		if q > 0 and qr > 0 and (q == qr):
			a[j] = q
	a1 = []
	for j in a:
		a1.append(str(j))
	if count == 1:
		print('-1')
	else:
		print(' '.join(a1))


for _ in range(int(input())):
	n = int(input())
	d = list(map(int, input().split()))
	flag = True
	for i in range(1, n):
		if d[i - 1] >= d[i] and d[i] != 0:
			flag = False
			print(-1)
			break
		d[i] = d[i] + d[i - 1]
	if flag:
		print(*d)


for t in range(int(input())):
	n = int(input())
	arr = list(map(int, input().split()))
	ans = list()
	ans.append(arr[0])
	for i in range(1, n):
		if ans[i - 1] - arr[i] < 0 or arr[i] == 0:
			ans.append(ans[i - 1] + arr[i])
		else:
			ans.clear()
			ans.append(-1)
			break
	print(*ans)


t = int(input())
for _ in range(t):
	n = int(input())
	d = list(map(int, input().split()))
	a = []
	elem = 0
	exist = True
	for i in range(n - 1):
		elem += d[i]
		if d[i + 1] == 0:
			a.append(elem)
		elif elem < d[i + 1]:
			a.append(elem)
		else:
			print(-1)
			exist = False
			break
	if exist:
		a.append(elem + d[-1])
		print(' '.join([str(s) for s in a]))


for _ in range(int(input())):
	len1 = int(input())
	d = list(map(int, input().rstrip().split()))
	a = [d[0]]
	flag = False
	for i in range(1, len1):
		t1 = a[i - 1] + d[i]
		t2 = a[i - 1] - d[i]
		if t1 < 0:
			a.append(t2)
		elif t2 < 0:
			a.append(t1)
		elif t1 == t2:
			a.append(t1)
		else:
			flag = True
			break
	if flag:
		print(-1)
	else:
		print(*a)


for _ in range(int(input())):
	n = int(input())
	d = [int(i) for i in input().split()]
	a = [d[0]]
	t = True
	for i in range(1, n):
		x = a[i - 1] + d[i]
		y = a[i - 1] - d[i]
		if x < 0 and y < 0 or (x >= 0 and y >= 0 and (x != y)):
			print(-1)
			t = False
			break
		elif x < 0:
			a.append(y)
		else:
			a.append(x)
	if t:
		print(*a)


t = int(input())
for x in range(t):
	n = int(input())
	d = list(map(int, input().split()))
	a = []
	a.append(d[0])
	for i in range(1, len(d)):
		a.append(d[i] + a[i - 1])
	count = 0
	for i in range(1, len(d)):
		if d[i] <= a[i - 1] and d[i] != 0:
			count += 1
	if count > 0:
		print(-1)
	else:
		print(*a)


t = int(input())
for tt in range(t):
	n = int(input())
	a = list(map(int, input().split()))
	b = [0] * n
	b[0] = a[0]
	for r in range(1, n):
		if b[r - 1] - a[r] < 0 or a[r] == 0:
			b[r] = b[r - 1] + a[r]
		else:
			print(-1)
			break
	else:
		print(' '.join(map(str, b)))


test = int(input())
for t in range(test):
	n = int(input())
	d = list(map(int, input().split()))
	a = [d[0]]
	nope = False
	for i in range(1, n):
		if a[i - 1] - d[i] >= 0 and d[i] != 0:
			nope = True
		else:
			a.append(a[i - 1] + d[i])
		if nope:
			break
	if nope:
		print(-1)
	else:
		print(*a)


def solve():
	n = int(input())
	d = list(map(int, input().split()))
	a = [0] * n
	a[0] = d[0]
	flag = 0
	for i in range(1, n):
		a[i] = a[i - 1] + d[i]
		if a[i - 1] >= d[i] and d[i] != 0:
			flag = 1
			break
	if flag:
		print(-1)
	else:
		print(' '.join((str(x) for x in a)))
for t in range(0, int(input())):
	solve()


for _ in range(int(input())):
	sol = int(input())
	ans = [0]
	for vr in map(int, input().split()):
		if vr != 0 and ans[-1] - vr >= 0:
			print(-1)
			break
		else:
			ans.append(ans[-1] + vr)
	else:
		print(*ans[1:])


for s in [*open(0)][2::2]:
	a = []
	c = h = 0
	for x in map(int, s.split()):
		h |= 0 < x <= c
		c += x
		a += (c,)
	print(*(a, [-1])[h])


t = int(input())
for i in range(t):
	n = int(input())
	a = [int(k) for k in input().split()]
	curr = []
	curr.append(a[0])
	v = True
	for j in range(1, n):
		if a[j] <= curr[j - 1] and a[j] > 0:
			print(-1)
			v = False
			break
		curr.append(curr[j - 1] + a[j])
	if v:
		print(*curr)


for asdasdas in range(int(input())):
	n = int(input())
	items_d = [int(i) for i in input().split()]
	items_a = [items_d[0]] + [0] * (n - 1)
	for i in range(1, n):
		gg = items_d[i] + items_a[i - 1]
		gg2 = -(items_d[i] - items_a[i - 1])
		if 0 <= gg != gg2 >= 0:
			print(-1)
			break
		res = max(gg, gg2)
		items_a[i] = res
	else:
		print(*items_a)


t = int(input())
for i in range(t):
	n = int(input())
	d = [int(j) for j in input().split()]
	a = []
	a.append(d[0])
	for j in range(1, n):
		if d[j] <= a[j - 1] and d[j] != 0:
			print(-1)
			break
		else:
			a.append(d[j] + a[j - 1])
	if len(a) == n:
		print(*a)