#include <bits/stdc++.h>   using namespace std;   long long a[300005];   long long c[300005] = {0};   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cout.tie(0);     ;     int n;     cin >> n;     int i;     for (i = 1; i <= n - 1; i++) cin >> a[i];     long long m = 0;     long long r = 0;     for (i = 1; i <= n - 1; i++) {       r += a[i];       m = min(m, r);     }     m = abs(m) + 1;     long long y = m;     if (m > n || c[m]) {       cout << -1;       return 0;     }     c[m] = 1;     for (i = 1; i <= n - 1; i++) {       m += a[i];       if (m > n || c[m]) {         cout << -1;         return 0;       }       c[m] = 1;     }     cout << y <<    ;     for (i = 1; i <= n - 1; i++) {       y += a[i];       cout << y <<    ;     }     return 0;   }   