N = input() b = [int(raw_input()) for _ in xrange(N)] a = [0 for _ in xrange(N+1)] a[0] = 1 for i in xrange(1, N+1): a[i] = b[i-1] - a[i-1] if i % 2 == 1 else a[i-1] - b[i-1] if a[i] <= 0: print -1 exit() print N+1 for x in a: print x