#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
set<int> s;
int n;
int a[2 * N];
int b[2 * N];
int main() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    cin >> a[i];
  }
  b[n - 1] = 1;
  s.insert(1);
  for (int i = n - 2; i >= 0; i--) {
    auto q = b[i + 1] - a[i];
    if (s.find(q) == s.end()) {
      b[i] = q;
      s.insert(q);
    } else {
      cout << -1;
      return 0;
    }
  }
  int mn = *(s.begin());
  int mx = *(s.rbegin());
  auto res = 1 - mn;
  if (mx + res != n) {
    cout << -1;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    cout << b[i] + res << " ";
  }
  return 0;
}
