#include <bits/stdc++.h>   using namespace std;   int n, a[200000];   bool st[200000][2];   long long memo[200000][2];   long long solve(int node, int rev) {     if (node < 0 || node >= n) return 0;     if (st[node][rev]) return 0x3f3f3f3f3f3f3f3fll;     if (node == 0) return 0;     long long& val = memo[node][rev];     if (val != 0xc0c0c0c0c0c0c0c0ll) return val;     st[node][rev] = true;     val = solve(node + a[node] * (1 - 2 * rev), 1 - rev);     if (val != 0x3f3f3f3f3f3f3f3fll) val += a[node];     st[node][rev] = false;     return val;   }   int main() {     ios::sync_with_stdio(0);     memset(st, false, sizeof st);     memset(memo, 0xc0c0c0c0c0c0c0c0ll, sizeof memo);     cin >> n;     for (int i = 1; i < n; ++i) cin >> a[i];     for (int i = 1; i < n; ++i) {       st[0][0] = true;       long long ans = solve(i, 1);       if (ans == 0x3f3f3f3f3f3f3f3fll)         ans = -1;       else         ans += i;       cout << ans << endl;     }   }   