n=gets.to_i b=[] n.times do b<< gets.to_i end l, r=1, 10**18 b.each_with_index do |e, i| if i.even? l, r=[1, e-r].max, e-l else l, r=[1, l-e].max, r-e end end if l>r puts (-1) exit(0) end a=[(l+r)/2] (n-1).downto 0 do |i| if (i+1).even? a<< b[i]+a.last else a<< b[i]-a.last end end puts a.size a.reverse.map{|e| puts e}