import sys inf = 10**9 + 1 def solve(): n = int(input()) a_min = 1 a_max = 10**18 v = 0 B = [] for i in range(n): b = int(sys.stdin.readline().rstrip()) B.append(b) if not (i & 1): v = -v if i & 1: v -= b else: v += b if (i >> 1) & 1: a_max = min(a_max, 10**18 - v) a_min = max(a_min, 1 - v) else: a_max = min(a_max, v - 1) a_min = max(a_min, v - 10**18) # print(a_min, a_max) if a_min > a_max: print(-1) return a = [0] * (n + 1) a[0] = a_min for i in range(1, n + 1): if i & 1: a[i] = B[i - 1] - a[i - 1] else: a[i] = a[i - 1] - B[i - 1] print(n + 1) print(*a, sep='\n') if __name__ == '__main__': solve()