#include using namespace std; typedef long long int64; int64 RANGE = 1000000000000000000LL; int main() { int N; int64 B[100000]; cin >> N; int64 xs = 1; bool f = false; for(int i = 0; i < N; i++) { cin >> B[i]; if(i & 1) xs = xs - B[i]; else xs = B[i] - xs; if(xs <= 0 || xs > RANGE) f = true; } int64 gs = B[0] - 1; bool g = false; for(int i = 0; i < N; i++) { if(i & 1) xs = xs - B[i]; else xs = B[i] - xs; if(xs <= 0 || xs > RANGE) g = true; } if(f && g) { cout << -1 << endl; return (0); } cout << N + 1 << endl; int64 rev = 1; if(f) rev = B[0] - 1; cout << rev << endl; for(int i = 0; i < N; i++) { if(i & 1) rev = rev - B[i]; else rev = B[i] - rev; cout << rev << endl; } }