#include using namespace std; const long long m = 1000000000000000000; int n; long long b[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) { long long t = l; l = max(1LL, b[i] - r); r = min(m, b[i] - t); } else { l = max(1LL, l - b[i]); r = min(m, r - b[i]); } } if(l > r) puts("-1"); else { printf("%d\n", n + 1); for(int i = 0; i < n + 1; i++) { printf("%lld\n", l); if(i & 1) l -= b[i]; else l = b[i] - l; } } return 0; }