#include #define _overload(_1,_2,_3,name,...) name #define _rep(i,n) _range(i,0,n) #define _range(i,a,b) for(int i=int(a);i=int(b);--i) #define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__) using namespace std; using ll=long long; // Problem Specific Parameter: const ll inf=1LL<<60; ll a[100001]; ll b[100000]; int main(void){ int n; cin >> n; rep(i,n) cin >> b[i]; ll low=1LL,high=inf; rep(i,n){ ll nlow,nhigh; // K=b[i] if(i%2==0){ // [low,high] -> [K-high,K-low] nlow=max(b[i]-high,1LL),nhigh=b[i]-low; }else{ // [low,high] -> [low-K,high-K] nlow=max(low-b[i],1LL),nhigh=high-b[i]; } low=nlow,high=nhigh; if(low>high) break; } if(low>high){ puts("-1"); return 0; } // a[n]=[low,high] a[n]=low; rrep(i,n){ if(i%2==0) a[i]=b[i]-a[i+1]; else a[i]=b[i]+a[i+1]; } cout << n+1 << endl; rep(i,n+1) cout << a[i] << endl; return 0; }