#include <bits/stdc++.h>
using namespace std;
long long q[500005], p[500005], pp[500005];
int main() {
  set<long long> s;
  long long n;
  cin >> n;
  long long pos = 0;
  long long minn = 999999999999999999;
  long long sum = 0;
  for (long long i = 0; i < n - 1; i++) {
    scanf("%lld", &q[i]);
    sum += q[i];
    if (sum <= minn && q[i] < 0) {
      pos = i + 1;
      minn = sum;
    }
  }
  p[pos] = 1;
  for (long long i = pos - 1; i >= 0; i--) {
    p[i] = p[i + 1] - q[i];
  }
  for (long long i = pos + 1; i < n; i++) {
    p[i] = p[i - 1] + q[i - 1];
  }
  for (long long i = 0; i < n; i++) {
    pp[i] = p[i];
  }
  sort(pp, pp + n);
  for (long long i = 1; i < n; i++) {
    if (pp[i] - pp[i - 1] != 1) {
      printf("-1\n");
      return 0;
    }
  }
  int d = 0;
  if (pp[0] != -1) d = pp[0] - 1;
  for (long long i = 0; i < n; i++) cout << p[i] - d << " ";
}
