lib C fun strtoll(s : UInt8*, p : UInt8**, b : Int32) : Int64 end class String def to_i64 C.strtoll(self, nil, 10) end end require "big" n = read_line.to_i b = (1..n).map { read_line.to_big_i } a = Array.new(n + 1, 0.to_big_i) n.times { |i| a[i + 1] = i.even? ? b[i] - a[i] : a[i] - b[i] } need = (0..n).select { |i| i % 4 == 0 || i % 4 == 3 }.max_of { |i| {1.to_big_i - a[i], 0.to_big_i}.max } can = (0..n).select { |i| i % 4 == 1 || i % 4 == 2 }.min_of { |i| {a[i] - 1.to_big_i, 0.to_big_i}.max } if need <= can (0..n).each do |i| if i % 4 == 0 || i % 4 == 3 a[i] += need else a[i] -= need end end puts n + 1, a.join("\n") else puts -1 end