#include using namespace std; const int64_t X = 1e18; int main() { int n; cin >> n; vector b(n); for (int i = 0; i < n; i++) { scanf("%lld", &b[i]); if ((i + 1) / 2 % 2 == 1) { b[i] *= -1; } } for (int i = 1; i < n; i++) { b[i] += b[i - 1]; if (abs(b[i]) > 2e18) { cout << -1 << endl; return 0; } } int64_t L = 1; int64_t R = X; for (int i = 0; i < n; i++) { if (i / 2 % 2 == 0) { L = max(L, -X + b[i]); R = min(R, -1 + b[i]); } else { L = max(L, 1 + b[i]); R = min(R, X + b[i]); } } if (L > R) { cout << -1 << endl; return 0; } vector a; a.push_back(L); for (int i = 0; i < n; i++) { if (i / 2 % 2 == 0) { a.push_back(-L + b[i]); } else { a.push_back(L - b[i]); } } for (int i = 0; i < a.size() - 1; i++) { if (i % 2 == 0) { cout << a[i] + a[i + 1] << endl; } else { cout << a[i] - a[i + 1] << endl; } } }