#include <bits/stdc++.h>
#define fi first
#define se second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define pb push_back
#define MP make_pair
#define lowbit(x) x&-x
#define clr(a) memset(a,0,sizeof(a))
#define _INF(a) memset(a,0x3f,sizeof(a))
#define FIN freopen("in.txt","r",stdin)
#define IOS ios::sync_with_stdio(false)
#define fuck(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>pii;
typedef pair<ll, ll>pll;
const int MX = 1e5 + 7;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;

int n, k, tot;
int root[MX * 40], ls[MX * 40], rs[MX * 40];
ll sum[MX * 40];
struct node {
	int x, r, q;

	bool operator<(const node &A)const {
		return r > A.r;
	}
} a[MX];
vector<int>h, g;
int get_id(int x) {
	return lower_bound(h.begin(), h.end(), x) - h.begin() + 1;
}
int get_id2(int x) {
	return lower_bound(g.begin(), g.end(), x) - g.begin() + 1;
}
void update(int p, int l, int r, int &rt) {
	if (!rt) rt = ++tot;
	sum[rt]++;
	if (l == r) return;
	int m = (l + r) >> 1;
	if (p <= m) update(p, l, m, ls[rt]);
	else update(p, m + 1, r, rs[rt]);
}
ll query(int L, int R, int l, int r, int rt) {
	if (!rt) return 0;
	if (L <= l && r <= R) return sum[rt];
	int m = (l + r) >> 1;
	if (R <= m) return query(L, R, l, m, ls[rt]);
	else if (L > m) return query(L, R, m + 1, r, rs[rt]);
	else return query(L, R, l, m, ls[rt]) + query(L, R, m + 1, r, rs[rt]);
}

int main() {
	// FIN;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d%d", &a[i].x, &a[i].r, &a[i].q);
		g.pb(a[i].x); h.pb(a[i].q);
	}
	sort(a + 1, a + n + 1);
	sort(h.begin(), h.end());
	h.erase(unique(h.begin(), h.end()), h.end());

	sort(g.begin(), g.end());
	g.erase(unique(g.begin(), g.end()), g.end());
	int N = g.size();
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		int st = max(0, a[i].q - k), ed = a[i].q + k;
		st = get_id(st); ed = get_id(ed);
		for (int j = st; j <= ed; j++) {
			if (!root[j]) continue;
			int L = max(0, a[i].x - a[i].r), R = a[i].x + a[i].r;
			L = get_id2(L); R = get_id2(R);
			ans += query(L, R, 1, N, root[j]);
		}
		a[i].q = get_id(a[i].q);
		a[i].x = get_id2(a[i].x);
		update(a[i].x, 1, N, root[a[i].q]);
	}
	cout << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
#define fi first
#define se second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define pb push_back
#define MP make_pair
#define lowbit(x) x&-x
#define clr(a) memset(a,0,sizeof(a))
#define _INF(a) memset(a,0x3f,sizeof(a))
#define FIN freopen("in.txt","r",stdin)
#define IOS ios::sync_with_stdio(false)
#define fuck(x) cout<<"["<<#x<<" "<<(x)<<"]"<<endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int>pii;
typedef pair<ll, ll>pll;
const int MX = 1e5 + 7;
const int mod = 1e9 + 7;
const int N = 1e9;
const int inf = 0x3f3f3f3f;

int n, k, tot;
int root[MX * 40], ls[MX * 40], rs[MX * 40];
ll sum[MX * 40];
struct node {
	int x, r, q;

	bool operator<(const node &A)const {
		return r > A.r;
	}
} a[MX];
vector<int>h;
int get_id(int x) {
	return lower_bound(h.begin(), h.end(), x) - h.begin() + 1;
}
void update(int p, int l, int r, int &rt) {
	if (!rt) rt = ++tot;
	sum[rt]++;
	if (l == r) return;
	int m = (l + r) >> 1;
	if (p <= m) update(p, l, m, ls[rt]);
	else update(p, m + 1, r, rs[rt]);
}
ll query(int L, int R, int l, int r, int rt) {
	if (!rt) return 0;
	if (L <= l && r <= R) return sum[rt];
	int m = (l + r) >> 1;
	ll res = 0;
	if (L <= m) res += query(L, R, l, m, ls[rt]);
	if (R > m) res += query(L, R, m + 1, r, rs[rt]);
	return res;
}

int main() {
	//FIN;
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d%d%d", &a[i].x, &a[i].r, &a[i].q);
		h.pb(a[i].q); h.pb(a[i].q - k); h.pb(a[i].q + k);
	}
	sort(a + 1, a + n + 1);
	sort(h.begin(), h.end());
	h.erase(unique(h.begin(), h.end()), h.end());
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		int st = a[i].q - k, ed = a[i].q + k;
		st = get_id(st); ed = get_id(ed);
		for (int j = st; j <= ed; j++) {
			if (!root[j]) continue;
			int L = max(0, a[i].x - a[i].r), R = min(N, a[i].x + a[i].r);
			ans += query(L, R, 0, N, root[j]);
		}
		a[i].q = get_id(a[i].q);
		update(a[i].x, 0, N, root[a[i].q]);
	}
	cout << ans << endl;
	return 0;
}


#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <stack>
#include <deque>
#include <iterator>
#include <tuple>
#include <iomanip>
#include <valarray>
#include <limits>
#include <sstream>
#include <cassert>
#include <functional>
#include <numeric>
#define in insert
#define pb push_back
#define mp make_pair
#define int long long
#define fi first
#define double long double
#define se second
#define endl '\n'
#define pii pair<int,int>
#define pdd pair<double,double>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define MAXN  301
#define ll unsigned long long
using namespace std;
using namespace __gnu_pbds;
 typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
 tree_order_statistics_node_update>
 ordered_set;
int spf[MAXN];
int fac[MAXN];
void sieve()//sieve
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)
        spf[i] = i;
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;
    for (int i=3; i*i<MAXN; i++)
    {
        if (spf[i]==i)
        {
            for (int j=i*i; j<MAXN; j+=i)
                if (spf[j]==j)
                    spf[j]=i;
        }
    }
}//sieve ends
map<int,int> getfactor(int a)//factor prime
{
    map<int,int> m;
    while(a>1)
    {
        m[spf[a]]++;
        a/=spf[a];
    }
    return m;
}//prime factor ends
int power(int x,int y,int p)
{
    int res = 1;
    x = x%p;
    //if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x)% p;
        y = y>>1;
        x = (x*x)%p;
    }
    return res;
}
int gcd(int a, int b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
int inverse(int a, int p)
{
    return power(a, p-2, p);
}
int ncr(int n, int r, int p)
{
    if(r>n)
        return 0;
    if (r==0)
        return 1;
    return (fac[n]*inverse(fac[r], p) % p *
            inverse(fac[n-r], p) % p) % p;
}
void solve()
{
    int n,k;
    cin>>n>>k;
    map<int,multiset<pii> >m1;
    map<int,ordered_set> m2;
    pair<int,pii> p[n+1];
    for(int i=1;i<=n;i++)
        cin>>p[i].fi>>p[i].se.fi>>p[i].se.se;
    sort(p+1,p+n+1);
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=p[i].se.se-k;j<=p[i].se.se+k;j++)
        {
            if(m1.find(j)==m1.end())
                continue;
            auto it=m1[j].begin();
            while(it!=m1[j].end()&&it->fi<p[i].fi)
            {
                auto it2=it;
                it++;
                m2[j].erase(m2[j].upper_bound(it2->se));
                m1[j].erase(it2);
            }
            ans+=m2[j].size()-m2[j].order_of_key(p[i].fi-p[i].se.fi);
        }
        m1[p[i].se.se].in(mp(p[i].fi+p[i].se.fi,p[i].fi));
        m2[p[i].se.se].in(p[i].fi);
    }
    cout<<ans<<endl;
}
signed main()
{
    fast
    int test=1;
    while(test--)
    {
        solve();
    }
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[500010];
ll cas[500010];
bool check[500010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0; cas[1] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    int mn = *min_element(cas + 1, cas + n + 1);
    bool check2[200010] = {false};
    for (int k(1); k <= n; ++k) {
        if (!check2[cas[k] + abs(mn) + 1] && cas[k] + abs(mn) + 1 > 0 && cas[k] + abs(mn) + 1 <= n) {
            check2[cas[k] + abs(mn) + 1] = true;
        } else {
            cout << - 1;
            return 0;
        }
    }
    for (int k(1); k <= n; ++k) {
        cout << cas[k] + abs(mn) + 1 << " ";
    }
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    for (int i(1); i <= n - 1; ++i) cin >> q[i];
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        bool check[200010] = {false};
        int siz(0);
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];
bool check[200010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        int siz(0);
        for (int j(1); j <= n; ++j) {
            fill(check, check + 200010, false);
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];
bool check[200010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0; cas[1] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    int mn = *min_element(cas + 1, cas + n + 1);
    bool check2[200010] = {false};
    for (int k(1); k <= n; ++k) {
        if (!check2[cas[k] + abs(mn) + 1] && cas[k] + abs(mn) + 1 > 0 && cas[k] + abs(mn) + 1 <= n) {
            check2[cas[k] + abs(mn) + 1] = true;
        } else {
            cout << - 1;
            return 0;
        }
    }
    for (int k(1); k <= n; ++k) {
        cout << cas[k] + abs(mn) + 1 << " ";
    }
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    int pos = -1;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    int i = 1;
    for (int u(0); u < 2; ++u) {
        int siz(0);
        bool check[200010] = {false};
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
        i = n;
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[500010];
ll cas[500010];
bool check[500010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0; cas[1] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    int mn = *min_element(cas + 1, cas + n + 1);
    bool check2[500010] = {false};
    for (int k(1); k <= n; ++k) {
        if (!check2[cas[k] + abs(mn) + 1] && cas[k] + abs(mn) + 1 > 0 && cas[k] + abs(mn) + 1 <= n) {
            check2[cas[k] + abs(mn) + 1] = true;
        } else {
            cout << - 1;
            return 0;
        }
    }
    for (int k(1); k <= n; ++k) {
        cout << cas[k] + abs(mn) + 1 << " ";
    }
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];
bool check[200010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0; cas[1] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
        if (!check[cas[i]]) check[cas[i]] = true;
        else {
            cout << -1;
            return 0;
        }
    }
    int mn = *min_element(cas + 1, cas + n + 1);
    int mx = *max_element(cas + 1, cas + n + 1);
    if (mx + abs(mn) + 1 > n) {
        cout << -1;
        return 0;
    }
    for (int k(1); k <= n; ++k) {
        cout << cas[k] + abs(mn) + 1 << " ";
    }
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];
bool check[200010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[1] = 0; cas[0] = 0;
    int pos = -1;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
        if (!check[cas[i]]) check[cas[i]] = true;
        else {
            cout << -1;
            return 0;
        }
    }
    int mn = *min_element(cas + 2, cas + n + 1);
    int mx = *max_element(cas + 2, cas + n + 1);
    if (mx + abs(mn) + 1 > n) {
        cout << -1;
        return 0;
    }
    for (int k(1); k <= n; ++k) {
        cout << cas[k] + abs(mn) + 1 << " ";
    }
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    vector<int> q(n + 1);
    for (int i(1); i <= n - 1; ++i) cin >> q[i];
    vector<ll> cas(n + 1);
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        set<ll> s;
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n) s.insert(cas[j] + i);
        }
        if (s.size() == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    for (int i(1); i <= n - 1; ++i) cin >> q[i];
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        bool check[200010] = {false};
        int siz(0);
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            }
        }
        if (siz == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];
bool check[200010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    int pos = -1;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
        if (!check[cas[i]]) check[cas[i]] = true;
        else {
            cout << -1;
            return 0;
        }
    }
    int mn = *min_element(cas + 1, cas + n + 1);
    int mx = *max_element(cas + 1, cas + n + 1);
    if (mx + abs(mn) + 1 > n) {
        cout << -1;
        return 0;
    }
    for (int k(1); k <= n; ++k) {
        cout << cas[k] + abs(mn) + 1 << " ";
    }
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        int siz(0);
        for (int j(1); j <= n; ++j) {
            bool check[200010] = {false};
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            cout << i << "\n";
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        int siz(0);
        bool check[200010] = {false};
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            cout << i << "\n";
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        int siz(0);
        bool check[200010] = {false};
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];
bool check[200010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        int siz(0);
        fill(check, check + 200010, false);
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            cout << i << "\n";
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        if (!(cas[1] + i == i)) continue;
        int siz(0);
        bool check[200010] = {false};
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define INF 1000000000
#define EPS 1e-20
#define pb push_back
constexpr double pi = 3.14159265358979323846;
/* 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ 乁(ᴗ ͜ʖ ᴗ)ㄏ */

int q[200010];
ll cas[200010];
bool check[200010] = {false};

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    cas[0] = 0;
    for (int i(2); i <= n; ++i) {
        cin >> q[i - 1];
        cas[i] = cas[i - 1] + q[i - 1];
    }
    for (int i(1); i <= n; ++i) {
        int siz(0);
        fill(check, check + 200010, false);
        for (int j(1); j <= n; ++j) {
            if (cas[j] + i > 0 && cas[j] + i <= n && !check[cas[j] + i]) {
                ++siz;
                check[cas[j] + i] = true;
            } else break;
        }
        if (siz == n) {
            for (int k(1); k <= n; ++k) {
                cout << cas[k] + i << " ";
            }
            return 0;
        }
    }
    cout << -1;
    cout << "\n"; /* new-line for VS code */
    return 0;
}


#include<bits/stdc++.h>
 using namespace std;
 #define ll long long
 #define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
 #define rep(i,a,b) for(int i=a;i<=b;i++)
 #define vi vector<ll>
 #define PI 3.14159265
 const ll MAX=1e5+100;
 const ll mod=1e9+7;
 const ll inf=1e18+12;
 //vector<ll>arr(MAX);
 ll mm[MAX];
                                                           //SAMEER KUMAR SINGH//
 //================================================================================================================================//

 ll f(ll n,ll p){
   while(n>p){
   ll l=0;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
         if(i<=p||n/i<=p){
          l=1;
          break;
          }
      }
   }if(l==0){
       return n;
    }n--;
   }
   return -1;
 }
 int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       ll a[n-1];
       ll s=0,x,d=n+1;
       vector<ll>vv,ans;
       for(ll i=0;i<n-1;i++){
        cin>>a[i];s+=a[i];
        vv.push_back(s);
        d=min(s,d);
       }
       //sort(vv.begin(),vv.end());
       if(d<0)
       x=1-d;
       if(d>0)
       x=1;
       map<ll,ll>mm;
       ll ck=0;
       if(x>0&&x<=n){
          mm[x]=1;ans.push_back(x);
          ck=1;
       }
       ll i=0,l=0;
       while(i<n-1&&ck==1){
          ll ele=vv[i]+x;
          if(ele>0&&ele<=n&&mm[ele]==0){
             ans.push_back(ele);mm[ele]=1;
          }
          else{
            l=1;break;
          }i++;
       }
       if(l==0&&ck==1){
         for(auto x:ans)
          cout<<x<<" ";
         return 0;
       }
       cout<<"-1";
    }
 }


#include<bits/stdc++.h>
 using namespace std;
 #define ll long long
 #define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
 #define rep(i,a,b) for(int i=a;i<=b;i++)
 #define vi vector<ll>
 #define PI 3.14159265
 const ll MAX=1e5+100;
 const ll mod=1e9+7;
 const ll inf=1e18+12;
 //vector<ll>arr(MAX);
 ll mm[MAX];
                                                           //SAMEER KUMAR SINGH//
 //================================================================================================================================//

 ll f(ll n,ll p){
   while(n>p){
   ll l=0;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
         if(i<=p||n/i<=p){
          l=1;
          break;
          }
      }
   }if(l==0){
       return n;
    }n--;
   }
   return -1;
 }
 int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       ll a[n-1];
       ll s=0,x;
       vector<ll>vv,ans;
       for(ll i=0;i<n-1;i++){
        cin>>a[i];s+=a[i];
        vv.push_back(s);
       }
       sort(vv.begin(),vv.end());
       if(vv[0]<0)
       x=1-vv[0];
       if(vv[0]>0)
       x=1;
       map<ll,ll>mm;
       if(x>0&&x<=n){
          mm[x]=1;ans.push_back(x);
       }
       ll i=0,l=0;
       while(i<n-1){
          ll ele=vv[i]+x;
          if(ele>0&&ele<=n&&mm[ele]==0){
             ans.push_back(ele);mm[ele]=1;
          }
          else{
            l=1;break;
          }i++;
       }
       if(l==0){
         for(auto x:ans)
          cout<<x<<" ";
         return 0;
       }
       cout<<"-1";
    }
 }


#include<bits/stdc++.h>
 using namespace std;
 #define ll long long
 #define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
 #define rep(i,a,b) for(int i=a;i<=b;i++)
 #define vi vector<ll>
 #define PI 3.14159265
 const ll MAX=1e6+100;
 const ll mod=1e9+7;
 const ll inf=1e18+12;
 //vector<ll>arr(MAX);
 map<ll,ll>mm;
                                                           //SAMEER KUMAR SINGH//
 //================================================================================================================================//

 ll f(ll n,ll p){
   while(n>p){
   ll l=0;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
         if(i<=p||n/i<=p){
          l=1;
          break;
          }
      }
   }if(l==0){
       return n;
    }n--;
   }
   return -1;
 }
 int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       ll a[n-1];
       for(ll i=0;i<n-1;i++)
        cin>>a[i];

       for(ll i=1;i<=n;i++){
          ll p2=a[0]+i;
          ll j=1,l=0;
          vector<ll>vv;
          map<ll,ll>mm;
          vv.push_back(i);
          mm[i]=1;
          ll k=1;
          if(mm[p2]!=1&&p2>0&&p2<=n){
          vv.push_back(p2);
          mm[p2]=1;
          }
          else
           k=0;
          while(p2>0&&p2<=n&&k==1){
             p2=a[j]+p2;
             if(p2>0&&p2<=n&&mm[p2]==0){
               vv.push_back(p2);mm[p2]==1;
             }
             else{
              break;
             }
             if(vv.size()==n){
               l=1;break;
             }j++;
          }
          if(l==1){
            for(auto x:vv)
             cout<<x<<" ";
             return 0;
          }
       }
       cout<<"-1";
    }
 }


#include<bits/stdc++.h>
 using namespace std;
 #define ll long long
 #define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
 #define rep(i,a,b) for(int i=a;i<=b;i++)
 #define vi vector<ll>
 #define PI 3.14159265
 const ll MAX=1e5+100;
 const ll mod=1e9+7;
 const ll inf=1e18+12;
 //vector<ll>arr(MAX);
 ll mm[MAX];
                                                           //SAMEER KUMAR SINGH//
 //================================================================================================================================//

 ll f(ll n,ll p){
   while(n>p){
   ll l=0;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
         if(i<=p||n/i<=p){
          l=1;
          break;
          }
      }
   }if(l==0){
       return n;
    }n--;
   }
   return -1;
 }
 int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       ll a[n-1];
       ll s=0,x;
       vector<ll>vv,ans;
       for(ll i=0;i<n-1;i++){
        cin>>a[i];s+=a[i];
        vv.push_back(s);
       }
       sort(vv.begin(),vv.end());
       if(vv[0]<0)
       x=1-vv[0];
       if(vv[0]>0)
       x=1;
       map<ll,ll>mm;
       ll ck=0;
       if(x>0&&x<=n){
          mm[x]=1;ans.push_back(x);
          ck=1;
       }
       ll i=0,l=0;
       while(i<n-1&&ck==1){
          ll ele=vv[i]+x;
          if(ele>0&&ele<=n&&mm[ele]==0){
             ans.push_back(ele);mm[ele]=1;
          }
          else{
            l=1;break;
          }i++;
       }
       if(l==0&&ck==1){
         for(auto x:ans)
          cout<<x<<" ";
         return 0;
       }
       cout<<"-1";
    }
 }


#include<bits/stdc++.h>
 using namespace std;
 #define ll long long
 #define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
 #define rep(i,a,b) for(int i=a;i<=b;i++)
 #define vi vector<ll>
 #define PI 3.14159265
 const ll MAX=1e6+100;
 const ll mod=1e9+7;
 const ll inf=1e18+12;
 //vector<ll>arr(MAX);
 map<ll,ll>mm;
                                                           //SAMEER KUMAR SINGH//
 //================================================================================================================================//

 ll f(ll n,ll p){
   while(n>p){
   ll l=0;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
         if(i<=p||n/i<=p){
          l=1;
          break;
          }
      }
   }if(l==0){
       return n;
    }n--;
   }
   return -1;
 }
 int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       ll a[n-1];
       for(ll i=0;i<n-1;i++)
        cin>>a[i];

       for(ll i=1;i<=n;i++){
          ll p2=a[0]+i;
          ll j=1,l=0;
          vector<ll>vv;
          map<ll,ll>mm;
          vv.push_back(i);
          mm[i]=1;ll k=1;
          if(mm[p2]!=1)
          vv.push_back(p2);
          else
           k=0;
          while(p2>0&&p2<=n&&k==1){
             p2=a[j]+p2;
             if(p2>0&&p2<=n&&mm[p2]==0){
               vv.push_back(p2);mm[p2]==1;
             }
             else{
              break;
             }
             if(vv.size()==n){
               l=1;break;
             }j++;
          }
          if(l==1){
            for(auto x:vv)
             cout<<x<<" ";
             return 0;
          }
       }
       cout<<"-1";
    }
 }


#include<bits/stdc++.h>
 using namespace std;
 #define ll long long
 #define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
 #define rep(i,a,b) for(int i=a;i<=b;i++)
 #define vi vector<ll>
 #define PI 3.14159265
 const ll MAX=1e6+100;
 const ll mod=1e9+7;
 const ll inf=1e18+12;
 //vector<ll>arr(MAX);
 map<ll,ll>mm;
                                                           //SAMEER KUMAR SINGH//
 //================================================================================================================================//

 ll f(ll n,ll p){
   while(n>p){
   ll l=0;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
         if(i<=p||n/i<=p){
          l=1;
          break;
          }
      }
   }if(l==0){
       return n;
    }n--;
   }
   return -1;
 }
 int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       ll a[n-1];
       for(ll i=0;i<n-1;i++)
        cin>>a[i];

       for(ll i=1;i<=n;i++){
          ll p2=a[0]+i;
          ll j=1,l=0;
          vector<ll>vv;
          vv.push_back(i);
          vv.push_back(p2);
          while(p2>0&&p2<=n){
             p2=a[j]+p2;
             if(p2>0&&p2<=n){
               vv.push_back(p2);
             }
             else{
              break;
             }
             if(vv.size()==n){
               l=1;break;
             }j++;
          }
          if(l==1){
            for(auto x:vv)
             cout<<x<<" ";
             return 0;
          }
       }
       cout<<"-1";
    }
 }


#include<bits/stdc++.h>
 using namespace std;
 #define ll long long
 #define FASTIO ios_base::sync_with_stdio(false);cout.tie(NULL);cout.tie(NULL);
 #define rep(i,a,b) for(int i=a;i<=b;i++)
 #define vi vector<ll>
 #define PI 3.14159265
 const ll MAX=1e6+100;
 const ll mod=1e9+7;
 const ll inf=1e18+12;
 //vector<ll>arr(MAX);
 map<ll,ll>mm;
                                                           //SAMEER KUMAR SINGH//
 //================================================================================================================================//

 ll f(ll n,ll p){
   while(n>p){
   ll l=0;
   for(ll i=2;i*i<=n;i++){
      if(n%i==0){
         if(i<=p||n/i<=p){
          l=1;
          break;
          }
      }
   }if(l==0){
       return n;
    }n--;
   }
   return -1;
 }
 int main(){
    FASTIO;
    ll tt=1;
    //cin>>tt;
    while(tt--){
       ll n;cin>>n;
       ll a[n-1];
       for(ll i=0;i<n-1;i++)
        cin>>a[i];

       for(ll i=1;i<=n;i++){
          ll p2=a[0]+i;
          ll j=1,l=0;
          vector<ll>vv;
          map<ll,ll>mm;
          vv.push_back(i);
          mm[i]=1;ll k=1;
          if(mm[p2]!=1){
          vv.push_back(p2);
          mm[p2]=1;
          }
          else
           k=0;
          while(p2>0&&p2<=n&&k==1){
             p2=a[j]+p2;
             if(p2>0&&p2<=n&&mm[p2]==0){
               vv.push_back(p2);mm[p2]==1;
             }
             else{
              break;
             }
             if(vv.size()==n){
               l=1;break;
             }j++;
          }
          if(l==1){
            for(auto x:vv)
             cout<<x<<" ";
             return 0;
          }
       }
       cout<<"-1";
    }
 }


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n];
      int mn=INT_MAX;
      a[0]=0;
      for(int i=1;i<n;i++)cin>>a[i],mn=min(mn,a[i]);
      ans[0]=(mn<0? abs(mn)+1:1);
      cnt[ans[0]]++;
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[i-1]+a[i];
          if(ans[i]>n || ans[i]<=0 || cnt[ans[i]]==1)
          {
              cout<<-1;
              return 0;
          }
          cnt[ans[i]]++;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n-1];
      for(int i=0;i<n-1;i++)cin>>a[i];
      if(a[0]>0)ans[0]=1;
      else ans[0]=n;
      cnt[ans[0]]++;
      bool ch=0;
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[i-1]+a[i-1];
          cnt[ans[i]]++;
          if(cnt[ans[i]]>1 || ans[i]>n || ans[i]<=0)
          {
              ch=1;
              break;
          }
      }
      if(ch)
      {
          cout<<-1;
          return 0;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n-1];
      for(int i=0;i<n-1;i++)cin>>a[i];
      if(a[0]>0)ans[0]=1;
      else if(n==2)ans[0]=n;
      else ans[0]=min(n-a[1]-a[0],n);
      cnt[ans[0]]++;
      bool ch=0;
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[i-1]+a[i-1];
          cnt[ans[i]]++;
          if(cnt[ans[i]]>1 || ans[i]>n || ans[i]<=0)
          {
              ch=1;
              break;
          }
      }
      if(ch)
      {
          cout<<-1;
          return 0;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n-1];
      for(int i=0;i<n-1;i++)cin>>a[i];
      if(a[0]>0)ans[0]=1;
      else ans[0]=n;
      cnt[ans[0]]++;
      bool ch=0;
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[i-1]+a[i-1];
          cnt[ans[i]]++;
          if(cnt[ans[i]]>1 || ans[i]>n || ans[i]<0)
          {
              ch=1;
              break;
          }
      }
      if(ch)
      {
          cout<<-1;
          return 0;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n-1];
      for(int i=0;i<n-1;i++)cin>>a[i];
      if(a[0]>0)ans[0]=1;
      else ans[0]=min(n-a[1]-a[0],n);
      cnt[ans[0]]++;
      bool ch=0;
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[i-1]+a[i-1];
          cnt[ans[i]]++;
          if(cnt[ans[i]]>1 || ans[i]>n || ans[i]<=0)
          {
              ch=1;
              break;
          }
      }
      if(ch)
      {
          cout<<-1;
          return 0;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n-1];
      for(int i=0;i<n-1;i++)cin>>a[i];
      bool ch=1;
      for(int j=1;j<=n;j++)
      {
          ans[0]=j;
          bool ch1=0;
          for(int i=1;i<n;i++)
          {
              ans[i]=ans[i-1]+a[i-1];
              if(ans[i]<=0 || ans[i]>n)
              {
                  ch1=1;
                  break;
              }
          }
          if(ch1)continue;
          for(int i=0;i<n;i++)cout<<ans[i]<<" ";
          ch=0;
          break;
      }
      if(ch)cout<<-1;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n];
      int mn=INT_MAX;
      a[0]=0;
      for(int i=1;i<n;i++)cin>>a[i],a[i]+=a[i-1],mn=min(mn,a[i]);
      ans[0]=(mn<0? abs(mn)+1:1);
      cnt[ans[0]]++;
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[0]+a[i];
          if(ans[i]>n || ans[i]<=0 || cnt[ans[i]]==1)
          {
              cout<<-1;
              return 0;
          }
          cnt[ans[i]]++;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n];
      int mn=INT_MAX;
      a[0]=0;
      for(int i=1;i<n;i++)cin>>a[i],a[i]+=a[i-1],mn=min(mn,a[i]);
      ans[0]=(mn<0? abs(mn)+1:1);
      if(ans[0]>n )
        {
            cout<<-1;
            return 0;
        }
      int b[n];
      b[0]=ans[0];
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[0]+a[i];
          b[i]=ans[i];
      }
      sort(b,b+n);
      for(int i=1;i<=n;i++)
      {
          if(b[i-1]!=i)
          {
              cout<<-1;
              return 0;
          }
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}

bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n];
      int mn=INT_MAX;
      a[0]=0;
      for(int i=1;i<n;i++)cin>>a[i],mn=min(mn,a[i]);
      ans[0]=(mn<0? abs(mn)+1:1);
      cnt[ans[0]]++;
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[i-1]+a[i];
          if(ans[i]>n || ans[i]<=0 || cnt[ans[i]]==1)
          {
              cout<<-1;
              return 0;
          }
          cnt[ans[i]]++;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n-1];
      for(int i=0;i<n-1;i++)cin>>a[i];
      bool ch=1;
      for(int j=1;j<=n;j++)
      {
          for(int i=0;i<=200000;i++)cnt[i]=0;
          ans[0]=j;
          cnt[j]++;
          bool ch1=0;
          for(int i=1;i<n;i++)
          {
              ans[i]=ans[i-1]+a[i-1];
              cnt[ans[i]]++;
              if(ans[i]<=0 || ans[i]>n || cnt[ans[i]]>1)
              {
                  ch1=1;
                  break;
              }
          }
          if(ch1)continue;
          for(int i=0;i<n;i++)cout<<ans[i]<<" ";
          ch=0;
          break;
      }
      if(ch)cout<<-1;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n];
      int mn=INT_MAX;
      a[0]=0;
      for(int i=1;i<n;i++)cin>>a[i],a[i]+=a[i-1],mn=min(mn,a[i]);
      ans[0]=(mn<0? abs(mn)+1:1);
      cnt[ans[0]]++;
      if(ans[0]>n || ans[0]<=0 )
        {
            cout<<-1;
            return 0;
        }
      for(int i=1;i<n;i++)
      {
          ans[i]=ans[0]+a[i];
          if(ans[i]>n || ans[i]<=0 || cnt[ans[i]]==1)
          {
              cout<<-1;
              return 0;
          }
          cnt[ans[i]]++;
      }
      for(int i=0;i<n;i++)cout<<ans[i]<<" ";
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const long double pi=3.14159265358979323846;
#define x  first
#define y  second
#define deb(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}

bool isPar(string s)
{
    ll n=s.size();
    for(int i=0;i<n/2;i++)
    {
        if(s[i]!=s[n-i-1])
        {
            return 0;
        }
    }
    return 1;
}

ll nOfD(ll n)
{
    ll d=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) d+=2;
        i++;
    }
    if(i * i == n)d++;
    return d;
}
ll sOfD(ll n)
{
    ll sum=0;
    ll i=1;
    while(i * i < n)
    {
        if(n%i ==0) sum+=i,sum+=n/i;
        i++;
    }
    if(i * i == n)sum+=i;
    return sum;
}
bool isP(ll x)
{
    if(x==2)return 1;
    if(x<2 || x%2==0)return 0;
    for(ll i=3;i * i <= x;i+=2)
    {
        if(x%i==0)return 0;
    }
    return 1;
}
ll lcm(ll a, ll b)
{
    return (a / __gcd(a, b) * b);
}
int cnt[200002]={};
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    ///freopen("ss.txt","r",stdin);
    ///freopen("out.txt","w",stdout);
    int t=1;
    //cin>>t;
    while(t--)
    {
      int n;
      cin>>n;
      int ans[n],a[n-1];
      for(int i=0;i<n-1;i++)cin>>a[i];
      bool ch=1;
      for(int j=1;j<=n;j++)
      {
          for(int i=0;i<=200000;i++)cnt[i]=0;
          ans[0]=j;
          cnt[j]++;
          bool ch1=0;
          for(int i=1;i<n;i++)
          {
              ans[i]=ans[i-1]+a[i-1];
              if(ans[i]<=0 || ans[i]>n || cnt[ans[i]]==1)
              {
                  ch1=1;
                  break;
              }
              cnt[ans[i]]++;
          }
          if(ch1)continue;
          for(int i=0;i<n;i++)cout<<ans[i]<<" ";
          ch=0;
          break;
      }
      if(ch)cout<<-1;
    }
    return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = abs(ans) + 1;
    for (int i=2; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
    {
    	used[x[i]] = 1;
	}
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = -ans + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
        used[x[i]] = 1;
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = abs(ans) + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
    {
    	if (x[i] <= 0)
    	{
    		cout << -1;
    		return 0;
		}
    	used[x[i]] = 1;
	}
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = -1 * ans + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    multiset <ll> nd;
    for (int i=1; i<=n; i++)
    	nd.insert(i);
    for (int i=1; i<=n; i++)
        nd.erase(*nd.find(x[i]));
    if (nd.size() != 0) cout << -1;
    else for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = abs(ans) + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
        used[x[i]] = 1;
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
	//freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], mn = INT_MAX, in, m[N];
	cin >> n;
	for (int i=1; i<=n; i++)
	{
        cin >> a[i];
        if (a[i] <= mn) mn = a[i], in = i;
	}
	m[in] = n;
    for (int i=in+1; i<=n; i++)
        m[i] = a[i-1] + m[i-1];
    for (int i=in-1; i>=1; i--)
        m[i] = m[i+1] - a[i];
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
        used[m[i]] = 1;
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << m[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=2; i<=n; i++)
        ans = min(ans, x[i]);
    ans = abs(ans) + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
        used[x[i]] = 1;
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 210005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = abs(ans) + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
        used[x[i]] = 1;
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 300005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = -1 * ans + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
        used[x[i]] = 1;
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = N;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = -1 * ans + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        //cout << x[i] << " ";
    }
    //cout << E;
    multiset <ll> nd;
    for (int i=1; i<=n; i++)
    	nd.insert(i);
    for (int i=1; i<=n; i++)
    {
    	if (nd.find(x[i]) == nd.end())
    	{
    		cout << -1;
    		return 0;
		}
    	nd.erase(*nd.find(x[i]));
	}

    if (nd.size() != 0) cout << -1;
    else for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
#pragma GCC optimize "03"
#define ll long long
#define pb push_back
#define mk make_pair

using namespace std;
const char E = '\n';
const int N = 200005;

int main()
{
    //freopen ("input.txt", "r", stdin);
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll n, a[N], m[N], x[N] = {0}, ans = INT_MAX;
	cin >> n;
	for (int i=1; i<=n-1; i++)
	{
        cin >> a[i];
	}
	for (int i=2; i<=n; i++)
	{
        x[i] = x[i-1] + a[i-1];
        //cout << x[i] << " ";
	}
	//cout << E;
    for (int i=1; i<=n; i++)
        ans = min(ans, x[i]);
    ans = -1 * ans + 1;
    for (int i=1; i<=n; i++)
    {
        x[i] = x[i] + ans;
        if (x[i] <= 0) return 0;
        //cout << x[i] << " ";
    }
    //cout << E;
    bool used[N] = {0};
    for (int i=1; i<=n; i++)
        used[x[i]] = 1;
    for (int i=1; i<=n; i++)
        if (used[i] == 0)
        {
            cout << -1;
            return 0;
        }
    for (int i=1; i<=n; i++)
        cout << x[i] << " ";
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=0,item,index,flag=1;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
        cin>>q[i];
    while(start<=n)
    {
        flag=1;
        start++;            //starting with start=1
        vector <lli> p;
        p.push_back(start);
        for(j=0;j<n-1;j++)
        {
            item = q[j]+p[j];           //item  =  p[i+1]
            if(item<=0)
                break;          //this iteration is wasted
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            p.push_back(item);
        }
    //    for(i=0;i<n;i++)
      //      cout<<p[i]<<' ';
        //cout<<"\n";
       // cout<<p.size()<<"\n";
        if(p.size()==n)        //means the vector p is full
        {
           // cout<<"hi";
            //check for multiple eleents
            vector <lli> f(n+1);
       //     for(j=0;j<n+1;j++)      f[i]=0;
            for(j=0;j<n;j++)
            {
                f[p[j]]++;
                if(f[p[j]]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                //print the vector
                for(j=0;j<n;j++)
                    cout<<p[j]<<' ';
                return 0;
            }
        }
        p.clear();
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    lli n,i,min_ele=0,sum=0;
    cin>>n;
    vector <lli> q(n-1);
    vector <lli> p(n);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
        if(min_ele > sum)
            min_ele = sum;
    }
    p[0]  = 1-min_ele;
    for(i=1;i<n;i++)
        p[i] = p[i-1]+q[i-1];
    for(i=0;i<n;i++)
    {
        if(p[i]<1 || p[i]>n)
        {
            cout<<-1;
            return 0;
        }
    }
    set <lli> s(p.begin(),p.end());
    if(s.size()==n)
    {
        for(i=0;i<n;i++)
            cout<<p[i]<<' ';
    }
    else
        cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
    }
    if(sum<0)
        start = 1 - sum;
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,mini=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
        if(mini > sum)
            mini = sum;
    }
    start = 1-mini;
    if(sum>n-1)
    {
        cout<<-1;
        return 0;
    }
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<1 || item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    cout<<-1;
                    return 0;
                }
            }

            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                cout<<index<<" ";
            }
            return 0;
        }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,one=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
        if(q[i]==1)
            one++;
    }
    if(sum<0)
        start = 1 - sum;
    if(sum==n-1 && one==sum)
    {
        for(i=0;i<n;i++)
            cout<<i+1<<' ';
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,one=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
        if(q[i]==1)
            one++;
    }
    if(sum<0)
        start = 1 - sum;
    if(sum==n-1 && one==sum)
    {
        for(i=0;i<n;i++)
            cout<<i+1<<' ';
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=0,item,index,flag=1;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
        cin>>q[i];
    while(start<=n)
    {
        flag=1;
        start++;            //starting with start=1
        vector <lli> p;
        p.push_back(start);
        for(j=0;j<n-1;j++)
        {
            item = q[j]+p[j];           //item  =  p[i+1]
            if(item<=0)
                break;          //this iteration is wasted
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            p.push_back(item);
        }
    //    for(i=0;i<n;i++)
      //      cout<<p[i]<<' ';
        //cout<<"\n";
       // cout<<p.size()<<"\n";
        if(p.size()==n)        //means the vector p is full
        {
           // cout<<"hi";
            //check for multiple eleents
            vector <lli> f(n+1);
       //     for(j=0;j<n+1;j++)      f[i]=0;
            for(j=0;j<n;j++)
            {
                f[p[j]]++;
                if(f[p[j]]>1)
                {
                    flag=0;
                    break;
                }
            }
            cout<<endl;

            if(flag==1)
            {
                //print the vector
                for(j=0;j<n;j++)
                    cout<<p[j]<<' ';
                return 0;
            }
        }
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
    }
    if(sum<0)
        start = 1 - sum;
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
           /* vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
           if(flag==1)
            {*/
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            //}
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,one=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
        if(a[i]==1)
            one++;
    }
    if(sum<0)
        start = 1 - sum;
    if(sum==n-1 && one==sum)
    {
        for(i=0;i<n;i++)
            cout<<i+1<<' ';
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
    }
    if(sum<0)
        start = 1 - sum;
    else if(sum==n-1)
    {
        for(i=0;i<n;i++)
            cout<<i+1<<' ';
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,mini=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
        if(mini > sum)
            mini = sum;
    }
    start = 1-mini;
    if(sum>n-1)
    {
        cout<<-1;
        return 0;
    }
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    cout<<-1;
                    return 0;
                }
            }

            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                cout<<index<<" ";
            }
            return 0;
        }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,one=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
        one++;
    }
    if(sum<0)
        start = 1 - sum;
    if(sum==n-1 && one==sum)
    {
        for(i=0;i<n;i++)
            cout<<i+1<<' ';
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,one=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        scanf("%lld",&q[i]);
        sum+=q[i];
        if(q[i]==1)
            one++;
    }
    if(sum<0)
        start = 1 - sum;
    if(sum==n-1 && one==sum)
    {
        for(i=1;i<=n;i++)
            printf("%d ",i);
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    lli i,j,n,start=1,item,index,flag=1,sz=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
        cin>>q[i];
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
    }
    if(sum<0)
        start = 1 - sum;
    else if(sum>n-1)
    {
        cout<<-1;
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        cin>>q[i];
        sum+=q[i];
    }
    if(sum<0)
        start = 1 - sum;
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define lli long long int
int main()
{
    ios_base::sync_with_stdio(false);   cin.tie(NULL);
    lli i,j,n,start=1,item,index,flag=1,sz=0,sum=0,one=0;
    cin>>n;
    vector <lli> q(n-1);
    for(i=0;i<n-1;i++)
    {
        scanf("%I64d",&q[i]);
        sum+=q[i];
        if(q[i]==1)
            one++;
    }
    if(sum<0)
        start = 1 - sum;
    if(sum==n-1 && one==sum)
    {
        for(i=1;i<=n;i++)
            printf("%d ",i);
        return 0;
    }
    while(start<=n)
    {
        sz=0;
        flag=1;
        item = start;
        for(j=0;j<n-1;j++)
        {
            item += q[j];
            if(item<=0)
                break;
            else if(item>n)
            {
                cout<<-1;
                return 0;
            }
            sz++;
        }
        if(sz==n-1)
        {
            vector <lli> f(n+1);
            for(j=0;j<n;j++)
            {
                if(j==0)
                    index = start;
                else
                    index += q[j-1];
                f[index]++;
                if(f[index]>1)
                {
                    flag=0;
                    break;
                }
            }
            if(flag==1)
            {
                for(j=0;j<n;j++)
                {
                    if(j==0)
                        index = start;
                    else
                        index += q[j-1];
                    cout<<index<<" ";
                }
                return 0;
            }
        }
        start++;
    }
    cout<<-1;
    return 0;
}