using System; using System.Linq; namespace No451 { class Program { static void Main(string[] args) { var n = Convert.ToInt32(Console.ReadLine()); var input = ReadLines(n); var evens = input.Where((x, i) => i % 2 == 0).ToArray(); var min = evens.Min(); if (min < 2) { Console.WriteLine(-1); return; } var minidx = getIndex(evens, min) * 2; var output = new long[n + 1]; output[minidx] = 1; for (var i = minidx - 1; i > -1; i--) { if (i % 2 == 1) { output[i] = input[i] + output[i + 1]; } else { output[i] = input[i] - output[i + 1]; } } for (var i = minidx; i < n; i++) { if (i % 2 == 1) { output[i+1] = output[i] - input[i]; } else { output[i+1] = input[i] - output[i]; } } if (output.Min() < 1 || output.Max() > 1000000000000000000) { Console.WriteLine(-1); return; } Console.WriteLine(n + 1); foreach(var num in output) { Console.WriteLine(num); } } static long[] ReadLines(int times) { var ret = new long[times]; for (var i = 0; i < times; i++) { ret[i] = Convert.ToInt64(Console.ReadLine()); } return ret; } static int getIndex(long[] array, long value) { for (var i = 0; i < array.Length; i++) { if(array[i] == value) { return i; } } return -1; } } }