#include using namespace std; #define rep(i,a,b) for(int i=a;i simulate(ll a0) { vector res; res.push_back(a0); rep(i, 0, N) { if (i % 2 == 0) res.push_back(B[i] - res[i]); else res.push_back(res[i] - B[i]); } return res; } //----------------------------------------------------------------------------------- int main() { cin >> N; rep(i, 0, N) scanf("%lld", &B[i]); vector a; a = simulate(1); /*rep(i, 0, N + 1) printf("%lld\n", a[i]); cout << endl;*/ ll L = 1, R = INF; rep(i, 0, N + 1) { if (i % 4 == 0 || i % 4 == 3) { if (a[i] <= 0) { L = max(L, 1 - a[i]); } } else { if (a[i] <= 0) { printf("-1\n"); return 0; } R = min(R, a[i]); } } if (R < L) { printf("-1\n"); return 0; } a = simulate(L); cout << N + 1 << endl; rep(i, 0, N + 1) printf("%lld\n", a[i]); }