#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define INF (1<<29) #define rep(i,n) for(int i=0;i<(int)(n);i++) #define all(v) v.begin(),v.end() #define uniq(v) v.erase(unique(all(v)),v.end()) long long maxv = 1000000000000000000; int n; long long b[100000]; void f() { long long lb, ub; lb = 1; ub = maxv + 1; for (int i = n; i > 0;i--) { if (i&1) { tie(lb, ub) = make_pair(b[i - 1] - ub - 1, b[i - 1] - lb + 1); } else { tie(lb, ub) = make_pair(b[i - 1] + lb, b[i - 1] + ub); } lb = max(lb, 1LL); ub = min(ub, maxv + 1); if (lb == ub || ub <= 1 || maxv < lb) { cout << -1 << endl; return; } } long long x = lb; cout << n + 1<< endl; cout << x << endl; for (int i = 1; i <= n;i++) { if (i & 1) { x = b[i - 1] - x; } else { x = x - b[i - 1]; } cout << x << endl; } } int main() { ios::sync_with_stdio(0); cin.tie(0); cin >> n; rep(i, n)cin >> b[i]; f(); return 0; }