#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  vector<long long> a;
  map<long long, long long> s;
  long long index = 0, N = 0, x = 0, minmi = 0, mi = 0;
  cin >> N;
  vector<long long> as(N, 0);
  for (long long i = 0; i < N - 1; i++) {
    cin >> x;
    if (mi == -1e9) {
      mi = x;
      index = i;
    } else {
      if ((mi + x) < minmi) {
        index = i + 1;
        minmi = mi + x;
      }
      mi += x;
    }
    a.push_back(x);
  }
  as[index] = 1;
  s[1] += 1;
  bool b = true;
  for (long long i = index; i < (N - 1); i++) {
    as[i + 1] = as[i] + a[i];
    if (s[as[i + 1]] == 1 or as[i + 1] < 0) {
      b = false;
      break;
    }
    s[as[i + 1]] += 1;
  }
  if (b) {
    for (long long i = index; i > 0; i--) {
      as[i - 1] = as[i] - a[i - 1];
      if (s[as[i - 1]] == 1 or as[i - 1] < 0) {
        b = false;
        break;
      }
      s[as[i - 1]] += 1;
    }
  }
  for (long long i = 1; i <= N; i++) {
    if (s[i] == 0) {
      b = false;
    }
  }
  if (b) {
    for (long long i = 0; i < as.size(); i++) {
      cout << as[i] << " ";
    }
  } else {
    cout << -1;
  }
  return 0;
}
