#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long int ll; using ull = unsigned long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n; cin >> n; vector b(n); for(int i=0;i> b[i]; } ll l=1LL,r=1LL<<60; for(int i=0;ir){ printf("-1\n"); } else{ vector a(n+1); a[n]=l; bool ok=1; for(int i=n-1;i>=0;i--){ if(i%2){ a[i]=b[i]+a[i+1]; } else{ a[i]=b[i]-a[i+1]; } if(a[i]<0)ok=0; } if(!ok){ printf("-1\n"); return 0; } printf("%d\n",n+1); for(int i=0;i<=n;i++){ printf("%lld\n",a[i]); } } }