n=gets.to_i b=Array.new(n) for i in 0...n b[i]=gets.to_i end a=Array.new(n+1) a[0]=0 for i in 0...n if i%2==0 a[i+1]=b[i]-a[i] else a[i+1]=a[i]-b[i] end end x=a[0] y=a[1] for i in 0..n if i%4==0||i%4==3 x=[a[i],x].min else y=[a[i],y].max end end if 1-x>y-1 puts -1 else puts n+1 for i in 0..n puts a[i]+(if i%4==0||i%4==3 then 1-x else x-1 end) end end