n=gets.to_i a=[] n.times do |i| a<< gets.to_i end b=[] b<< 1 (n/2).times do |i| b<< a[i*2]-b[i*2] b<< b[i*2+1]-a[i*2+1] end (n%2).times do b<< a[-1]-b[-1] end c=1 n.times do |i| c=b[i] if c>b[i] end b=[] b<< c (n/2).times do |i| b<< a[i*2]-b[i*2] b<< b[i*2+1]-a[i*2+1] end (n%2).times do b<< a[-1]-b[-1] end if b.all?{|i|i>0} puts n+1,b.*("\n") else p -1 end