#include using namespace std; const long long m = 1000000000000000000; int n; long long b[100009], a[100009]; int main() { scanf("%d", &n); for(int i = 0; i < n; i++) scanf("%lld", &b[i]); long long l = 1, r = m; for(int i = 0; i < n; i++) { if(i & 1) { l = max(1LL, l - b[i]); r = max(1LL, min(m, r - b[i])); } else { long long t = l; l = max(1LL, b[i] - r); r = max(1LL, min(m, b[i] - t)); } //cout << l << ' ' << r << endl; } if(l > r) puts("-1"); else { printf("%d\n", n + 1); for(int i = n; i >= 0; i--) { a[i] = l; if((i + 1) & 1) l += b[i - 1]; else l = b[i - 1] - l; } for(int i = 0; i <= n; i++) printf("%lld\n", a[i]); } return 0; }