#include <bits/stdc++.h>
using namespace std;
template <typename T>
using COUPLE = array<T, 2>;
template <typename T>
using TRIPLE = array<T, 3>;
template <typename T>
using QUAD = array<T, 4>;
using Byte = uint8_t;
using LLD = int64_t;
using ULLD = uint64_t;
using UINT = uint32_t;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VPII = vector<PII>;
using MII = map<int, int>;
using SI = set<int>;
using VVP = vector<VPII>;
using PLLD = pair<LLD, LLD>;
using VLLD = vector<LLD>;
using VVLLD = vector<VLLD>;
using VPLLD = vector<PLLD>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VCh = vector<char>;
using VVCh = vector<VCh>;
using CI = COUPLE<int>;
using TI = TRIPLE<int>;
using QI = QUAD<int>;
using VCI = vector<CI>;
using VTI = vector<TI>;
using VQI = vector<QI>;
template <size_t n>
using INTARR = array<int, n>;
template <int D, typename Tp>
struct Vecnd : public vector<Vecnd<D - 1, Tp>> {
  template <typename... Args>
  Vecnd(int n, Args... args)
      : vector<Vecnd<D - 1, Tp>>(n, Vecnd<D - 1, Tp>(args...)) {}
};
template <typename Tp>
struct Vecnd<1, Tp> : public vector<Tp> {
  Vecnd(int n, const Tp &val = Tp()) : vector<Tp>(n, val) {}
};
template <typename T>
using Vec1d = Vecnd<1, T>;
template <typename T>
using Vec2d = Vecnd<2, T>;
template <typename T>
using Vec3d = Vecnd<3, T>;
template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using max_heap = priority_queue<T, vector<T>, less<T>>;
const int INF = 2147483647 / 2;
const LLD LLDINF = INT64_MAX / 2;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
int operator~(const string &s) { return (int)(s.size()); }
char &operator*(string &s, int v) { return *(s.rbegin() + v); }
char &operator-(string &s) { return s.back(); }
template <typename T, typename... Args>
int operator~(const vector<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(vector<T, Args...> &s, const T &v) {
  s.push_back(v);
}
template <typename T, typename... Args>
void operator+=(vector<T, Args...> &s, const vector<T, Args...> &v) {
  for (int i = 0; i < (~v); ++i) {
    s += v[i];
  }
}
template <typename T, typename... Args>
T &operator-(vector<T, Args...> &s) {
  return s.back();
}
template <typename T, typename... Args>
T &operator*(vector<T, Args...> &s, int v) {
  return *(s.rbegin() + v);
}
template <typename T, typename... Args>
T operator--(vector<T, Args...> &s, int) {
  auto k = s.back();
  s.pop_back();
  return k;
}
template <typename T, typename... Args>
void dedup(vector<T, Args...> &s) {
  sort((s).begin(), (s).end());
  s.erase(unique((s).begin(), (s).end()), s.end());
}
template <typename T, typename... Args>
typename vector<T, Args...>::iterator find(vector<T, Args...> &s, const T &x) {
  auto it = lower_bound((s).begin(), (s).end(), x);
  return (it != s.end() && *it == x) ? it : s.end();
}
template <typename T, typename... Args>
int index(vector<T, Args...> &s, const T &x) {
  auto it = find(s, x);
  check(it != s.end() && *it == x);
  return it - s.begin();
}
template <typename T, size_t n>
int operator~(const array<T, n> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(stack<T, Args...> &s, const T &v) {
  s.push(v);
}
template <typename T, typename... Args>
T &operator-(stack<T, Args...> &s) {
  return s.top();
}
template <typename T, typename... Args>
T operator--(stack<T, Args...> &s, int) {
  auto k = s.top();
  s.pop();
  return k;
}
template <typename T, typename... Args>
int operator~(const stack<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(queue<T, Args...> &s, const T &v) {
  s.push(v);
}
template <typename T, typename... Args>
T &operator-(queue<T, Args...> &s) {
  return s.front();
}
template <typename T, typename... Args>
T operator--(queue<T, Args...> &s) {
  auto k = s.front();
  s.pop();
  return k;
}
template <typename T, typename... Args>
int operator~(const queue<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(deque<T, Args...> &s, const T &v) {
  s.push_back(v);
}
template <typename T, typename... Args>
void operator+=(const T &v, deque<T, Args...> &s) {
  s.push_front(v);
}
template <typename T, typename... Args>
T &operator-(deque<T, Args...> &s) {
  return s.back();
}
template <typename T, typename... Args>
T &operator+(deque<T, Args...> &s) {
  return s.front();
}
template <typename T, typename... Args>
T operator--(deque<T, Args...> &s, int) {
  auto k = s.back();
  s.pop_back();
  return k;
}
template <typename T, typename... Args>
T operator--(deque<T, Args...> &s) {
  auto k = s.front();
  s.pop_front();
  return k;
}
template <typename T, typename... Args>
int operator~(const deque<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(priority_queue<T, Args...> &s, const T &v) {
  s.push(v);
}
template <typename T, typename... Args>
const T &operator-(priority_queue<T, Args...> &s) {
  return s.top();
}
template <typename T, typename... Args>
T operator--(priority_queue<T, Args...> &s) {
  auto k = s.top();
  s.pop();
  return k;
}
template <typename T, typename... Args>
int operator~(const priority_queue<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(set<T, Args...> &s, T &v) {
  s.insert(v);
}
template <typename T, typename... Args>
void operator-=(set<T, Args...> &s, T &v) {
  s.erase(v);
}
template <typename T, typename... Args>
bool operator<(T &v, set<T, Args...> &s) {
  return s.find(v) != s.end();
}
template <typename T, typename... Args>
bool operator>(T &v, set<T, Args...> &s) {
  return s.find(v) == s.end();
}
template <typename T, typename... Args>
int operator~(const set<T, Args...> &s) {
  return (int)s.size();
}
template <typename K, typename V>
void operator+=(map<K, V> &s, pair<K, V> &v) {
  s.insert(v);
}
template <typename K, typename V>
void operator-=(map<K, V> &s, K &v) {
  s.erase(v);
}
template <typename T, typename... Args>
bool operator<(T v, const map<T, Args...> &s) {
  return s.find(v) != s.end();
}
template <typename T, typename... Args>
bool operator>(T v, const map<T, Args...> &s) {
  return s.find(v) == s.end();
}
template <typename T, typename... Args>
int operator~(const map<T, Args...> &s) {
  return (int)s.size();
}
template <typename... Args>
string fmt(const string &format, Args... args) {
  return "";
}
template <typename T>
void __pvec(T &v) {}
template <typename T>
void __p2vec(T &v) {}
template <typename T>
void __pmat(T &v) {}
template <typename K, typename V>
void read(pair<K, V> &p);
template <typename T>
void read(vector<T> &v);
template <typename T>
void read(T &x);
template <typename T, typename... Args>
void read(T &head, Args &...rest);
template <typename K, typename V>
void read(pair<K, V> &p) {
  read(p.first, p.second);
}
template <typename T>
void read(vector<T> &v) {
  for (int i = 0; i < (~v); ++i) cin >> v[i];
}
template <typename T>
void read(T &x) {
  cin >> x;
}
template <typename T, typename... Args>
void read(T &head, Args &...rest) {
  read(head), read(rest...);
}
const char *__sep__[2] = {", ", " "};
template <typename... Args>
ostream &operator<<(ostream &os, const vector<Args...> &v) {
  os << "[ ";
  for (int i = 0; i < (~v); ++i) {
    os << v[i] << __sep__[i + 1 == ~v];
  }
  return os << "]";
}
template <typename T, size_t n>
ostream &operator<<(ostream &os, const array<T, n> &v) {
  os << "[ ";
  for (int i = 0; i < (~v); ++i) {
    os << v[i] << __sep__[i + 1 == ~v];
  }
  return os << "]";
}
template <typename... Args>
ostream &operator<<(ostream &os, const set<Args...> &v) {
  os << "{ ";
  for (auto it = (v).begin(); it != (v).end(); ++it)
    os << *it << __sep__[next(it) == v.end()];
  return os << "}";
}
template <typename K, typename V>
ostream &operator<<(ostream &os, const map<K, V> &v) {
  os << "{ ";
  for (auto it = (v).begin(); it != (v).end(); ++it)
    os << it->first << ": " << it->second << __sep__[next(it) == v.end()];
  return os << "}";
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const priority_queue<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = 0; i < (~Z); ++i) {
    Z[i] = --tmp;
  }
  return os << Z;
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const deque<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = 0; i < (~Z); ++i) {
    Z[i] = --tmp;
  }
  return os << Z;
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const stack<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = (~Z) - 1; i >= 0; --i) {
    Z[i] = tmp--;
  }
  return os << Z;
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const queue<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = 0; i < (~Z); ++i) {
    Z[i] = --tmp;
  }
  return os << Z;
}
template <typename K, typename V>
ostream &operator<<(ostream &os, const pair<K, V> &v) {
  return os << "(" << v.first << __sep__[0] << v.second << ")";
}
template <typename K, typename V>
ostream &operator<<(ostream &os, const tuple<K, V> &v) {
  return os << "(" << get<0>(v) << __sep__[0] << get<1>(v) << ")";
}
template <typename K, typename V, typename T>
ostream &operator<<(ostream &os, const tuple<K, V, T> &v) {
  return os << "(" << get<0>(v) << __sep__[0] << get<1>(v) << __sep__[0]
            << get<2>(v) << ")";
}
template <typename T>
void __swrite(const char *sep, const T &x) {
  cout << x << sep;
}
template <typename T, typename... Args>
void __swrite(const char *sep, const T &x, const Args &...a) {
  cout << x << sep;
  __swrite(sep, a...);
}
template <typename... Args>
void writeln(const Args &...a) {
  __swrite("\n", a...);
}
void writeln() { cout << "\n"; }
template <typename... Args>
void writes(const Args &...a) {
  __swrite(" ", a...);
}
template <typename... Args>
void writesln(const Args &...a) {
  __swrite(" ", a...);
  writeln();
}
template <typename... Args>
void write(const Args &...a) {
  __swrite("", a...);
}
template <typename T, typename... Args>
void mkmax(T &a, const Args &...z) {
  a = max({a, z...});
}
template <typename T, typename... Args>
void mkmin(T &a, const Args &...z) {
  a = min({a, z...});
}
template <typename T, typename... Args>
bool ckmax(T &a, const Args &...z) {
  auto t = a;
  mkmax(a, z...);
  return (a != t);
}
template <typename T, typename... Args>
bool ckmin(T &a, const Args &...z) {
  auto t = a;
  mkmin(a, z...);
  return (a != t);
}
int log2_floor(UINT n) { return 31 - __builtin_clz(n); }
int log2_ceil(UINT n) { return log2_floor(n) + !!(n & (n - 1)); }
int log2_floor64(ULLD n) { return 63 - __builtin_clzll(n); }
int log2_ceil64(ULLD n) { return log2_floor64(n) + !!(n & (n - 1ULL)); }
template <size_t n>
bitset<n> reverse_bitset(const bitset<n> &x) {
  auto y = x.to_string();
  reverse((y).begin(), (y).end());
  return bitset<n>(y);
}
class Rng {
  mt19937 mtgen;
  uniform_int_distribution<int> dist_;

 public:
  Rng(int min, int max, size_t seed = random_device()())
      : mtgen(seed), dist_(min, max) {}
  int operator()() { return dist_(mtgen); }
};
VI randomvec(int sz) {
  Rng rg(0, 10);
  VI s;
  for (int i = 0; i < (sz); ++i) s += rg();
  return s;
}
string randomstring(int sz) {
  Rng rg((int)'a', (int)'z');
  string s;
  for (int i = 0; i < (sz); ++i) s += (char)rg();
  return s;
}
void soln(int __ntc, int __tc) {
  int n;
  read(n);
  ;
  VLLD A(n + 1, 0);
  for (int i = (2); i <= (n); ++i) {
    read(A[i]);
  }
  Vec2d<LLD> dp(2, n + 1, -1);
  Vec2d<bool> vis(2, n + 1, 0);
  vis[1][1] = 1;
  function<LLD(int t, LLD x)> comp = [&](int t, LLD x) -> LLD {
    if (x > n || x <= 0) {
      return 0LL;
    } else if (vis[t][x]) {
      return dp[t][x] = LLDINF;
    } else if (dp[t][x] != -1) {
      return dp[t][x];
    } else {
      vis[t][x] = 1;
      LLD a = comp(t ^ 1, (t) ? x - A[x] : x + A[x]);
      dp[t][x] = (a != LLDINF) ? A[x] + a : LLDINF;
      vis[t][x] = 0;
      return dp[t][x];
    }
  };
  for (int i = 2; i <= n; ++i) {
    comp(1, i);
  }
  for (int i = 1; i <= n - 1; ++i) {
    int x = 1 + i, y = i;
    if (dp[1][x] != LLDINF) {
      writesln(y + dp[1][x]);
    } else {
      writesln(-1);
      ;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  soln(1, 1);
}

### Prompt

Please create a solution in cpp to the following problem:

Farmer John has just given the cows a program to play with! The program contains two integer variables, x and y, and performs the following operations on a sequence a1, a2, ..., an of positive integers:

  1. Initially, x = 1 and y = 0. If, after any step, x ≤ 0 or x > n, the program immediately terminates. 
  2. The program increases both x and y by a value equal to ax simultaneously. 
  3. The program now increases y by ax while decreasing x by ax. 
  4. The program executes steps 2 and 3 (first step 2, then step 3) repeatedly until it terminates (it may never terminate). So, the sequence of executed steps may start with: step 2, step 3, step 2, step 3, step 2 and so on. 



The cows are not very good at arithmetic though, and they want to see how the program works. Please help them!

You are given the sequence a2, a3, ..., an. Suppose for each i (1 ≤ i ≤ n - 1) we run the program on the sequence i, a2, a3, ..., an. For each such run output the final value of y if the program terminates or -1 if it does not terminate.

Input

The first line contains a single integer, n (2 ≤ n ≤ 2·105). The next line contains n - 1 space separated integers, a2, a3, ..., an (1 ≤ ai ≤ 109).

Output

Output n - 1 lines. On the i-th line, print the requested value when the program is run on the sequence i, a2, a3, ...an.

Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

Examples

Input

4
2 4 1


Output

3
6
8


Input

3
1 2


Output

-1
-1

Note

In the first sample 

  1. For i = 1,  x becomes <image> and y becomes 1 + 2 = 3. 
  2. For i = 2,  x becomes <image> and y becomes 2 + 4 = 6.
  3. For i = 3,  x becomes <image> and y becomes 3 + 1 + 4 = 8.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using COUPLE = array<T, 2>;
template <typename T>
using TRIPLE = array<T, 3>;
template <typename T>
using QUAD = array<T, 4>;
using Byte = uint8_t;
using LLD = int64_t;
using ULLD = uint64_t;
using UINT = uint32_t;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
using VPII = vector<PII>;
using MII = map<int, int>;
using SI = set<int>;
using VVP = vector<VPII>;
using PLLD = pair<LLD, LLD>;
using VLLD = vector<LLD>;
using VVLLD = vector<VLLD>;
using VPLLD = vector<PLLD>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VCh = vector<char>;
using VVCh = vector<VCh>;
using CI = COUPLE<int>;
using TI = TRIPLE<int>;
using QI = QUAD<int>;
using VCI = vector<CI>;
using VTI = vector<TI>;
using VQI = vector<QI>;
template <size_t n>
using INTARR = array<int, n>;
template <int D, typename Tp>
struct Vecnd : public vector<Vecnd<D - 1, Tp>> {
  template <typename... Args>
  Vecnd(int n, Args... args)
      : vector<Vecnd<D - 1, Tp>>(n, Vecnd<D - 1, Tp>(args...)) {}
};
template <typename Tp>
struct Vecnd<1, Tp> : public vector<Tp> {
  Vecnd(int n, const Tp &val = Tp()) : vector<Tp>(n, val) {}
};
template <typename T>
using Vec1d = Vecnd<1, T>;
template <typename T>
using Vec2d = Vecnd<2, T>;
template <typename T>
using Vec3d = Vecnd<3, T>;
template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using max_heap = priority_queue<T, vector<T>, less<T>>;
const int INF = 2147483647 / 2;
const LLD LLDINF = INT64_MAX / 2;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
int operator~(const string &s) { return (int)(s.size()); }
char &operator*(string &s, int v) { return *(s.rbegin() + v); }
char &operator-(string &s) { return s.back(); }
template <typename T, typename... Args>
int operator~(const vector<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(vector<T, Args...> &s, const T &v) {
  s.push_back(v);
}
template <typename T, typename... Args>
void operator+=(vector<T, Args...> &s, const vector<T, Args...> &v) {
  for (int i = 0; i < (~v); ++i) {
    s += v[i];
  }
}
template <typename T, typename... Args>
T &operator-(vector<T, Args...> &s) {
  return s.back();
}
template <typename T, typename... Args>
T &operator*(vector<T, Args...> &s, int v) {
  return *(s.rbegin() + v);
}
template <typename T, typename... Args>
T operator--(vector<T, Args...> &s, int) {
  auto k = s.back();
  s.pop_back();
  return k;
}
template <typename T, typename... Args>
void dedup(vector<T, Args...> &s) {
  sort((s).begin(), (s).end());
  s.erase(unique((s).begin(), (s).end()), s.end());
}
template <typename T, typename... Args>
typename vector<T, Args...>::iterator find(vector<T, Args...> &s, const T &x) {
  auto it = lower_bound((s).begin(), (s).end(), x);
  return (it != s.end() && *it == x) ? it : s.end();
}
template <typename T, typename... Args>
int index(vector<T, Args...> &s, const T &x) {
  auto it = find(s, x);
  check(it != s.end() && *it == x);
  return it - s.begin();
}
template <typename T, size_t n>
int operator~(const array<T, n> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(stack<T, Args...> &s, const T &v) {
  s.push(v);
}
template <typename T, typename... Args>
T &operator-(stack<T, Args...> &s) {
  return s.top();
}
template <typename T, typename... Args>
T operator--(stack<T, Args...> &s, int) {
  auto k = s.top();
  s.pop();
  return k;
}
template <typename T, typename... Args>
int operator~(const stack<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(queue<T, Args...> &s, const T &v) {
  s.push(v);
}
template <typename T, typename... Args>
T &operator-(queue<T, Args...> &s) {
  return s.front();
}
template <typename T, typename... Args>
T operator--(queue<T, Args...> &s) {
  auto k = s.front();
  s.pop();
  return k;
}
template <typename T, typename... Args>
int operator~(const queue<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(deque<T, Args...> &s, const T &v) {
  s.push_back(v);
}
template <typename T, typename... Args>
void operator+=(const T &v, deque<T, Args...> &s) {
  s.push_front(v);
}
template <typename T, typename... Args>
T &operator-(deque<T, Args...> &s) {
  return s.back();
}
template <typename T, typename... Args>
T &operator+(deque<T, Args...> &s) {
  return s.front();
}
template <typename T, typename... Args>
T operator--(deque<T, Args...> &s, int) {
  auto k = s.back();
  s.pop_back();
  return k;
}
template <typename T, typename... Args>
T operator--(deque<T, Args...> &s) {
  auto k = s.front();
  s.pop_front();
  return k;
}
template <typename T, typename... Args>
int operator~(const deque<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(priority_queue<T, Args...> &s, const T &v) {
  s.push(v);
}
template <typename T, typename... Args>
const T &operator-(priority_queue<T, Args...> &s) {
  return s.top();
}
template <typename T, typename... Args>
T operator--(priority_queue<T, Args...> &s) {
  auto k = s.top();
  s.pop();
  return k;
}
template <typename T, typename... Args>
int operator~(const priority_queue<T, Args...> &s) {
  return (int)s.size();
}
template <typename T, typename... Args>
void operator+=(set<T, Args...> &s, T &v) {
  s.insert(v);
}
template <typename T, typename... Args>
void operator-=(set<T, Args...> &s, T &v) {
  s.erase(v);
}
template <typename T, typename... Args>
bool operator<(T &v, set<T, Args...> &s) {
  return s.find(v) != s.end();
}
template <typename T, typename... Args>
bool operator>(T &v, set<T, Args...> &s) {
  return s.find(v) == s.end();
}
template <typename T, typename... Args>
int operator~(const set<T, Args...> &s) {
  return (int)s.size();
}
template <typename K, typename V>
void operator+=(map<K, V> &s, pair<K, V> &v) {
  s.insert(v);
}
template <typename K, typename V>
void operator-=(map<K, V> &s, K &v) {
  s.erase(v);
}
template <typename T, typename... Args>
bool operator<(T v, const map<T, Args...> &s) {
  return s.find(v) != s.end();
}
template <typename T, typename... Args>
bool operator>(T v, const map<T, Args...> &s) {
  return s.find(v) == s.end();
}
template <typename T, typename... Args>
int operator~(const map<T, Args...> &s) {
  return (int)s.size();
}
template <typename... Args>
string fmt(const string &format, Args... args) {
  return "";
}
template <typename T>
void __pvec(T &v) {}
template <typename T>
void __p2vec(T &v) {}
template <typename T>
void __pmat(T &v) {}
template <typename K, typename V>
void read(pair<K, V> &p);
template <typename T>
void read(vector<T> &v);
template <typename T>
void read(T &x);
template <typename T, typename... Args>
void read(T &head, Args &...rest);
template <typename K, typename V>
void read(pair<K, V> &p) {
  read(p.first, p.second);
}
template <typename T>
void read(vector<T> &v) {
  for (int i = 0; i < (~v); ++i) cin >> v[i];
}
template <typename T>
void read(T &x) {
  cin >> x;
}
template <typename T, typename... Args>
void read(T &head, Args &...rest) {
  read(head), read(rest...);
}
const char *__sep__[2] = {", ", " "};
template <typename... Args>
ostream &operator<<(ostream &os, const vector<Args...> &v) {
  os << "[ ";
  for (int i = 0; i < (~v); ++i) {
    os << v[i] << __sep__[i + 1 == ~v];
  }
  return os << "]";
}
template <typename T, size_t n>
ostream &operator<<(ostream &os, const array<T, n> &v) {
  os << "[ ";
  for (int i = 0; i < (~v); ++i) {
    os << v[i] << __sep__[i + 1 == ~v];
  }
  return os << "]";
}
template <typename... Args>
ostream &operator<<(ostream &os, const set<Args...> &v) {
  os << "{ ";
  for (auto it = (v).begin(); it != (v).end(); ++it)
    os << *it << __sep__[next(it) == v.end()];
  return os << "}";
}
template <typename K, typename V>
ostream &operator<<(ostream &os, const map<K, V> &v) {
  os << "{ ";
  for (auto it = (v).begin(); it != (v).end(); ++it)
    os << it->first << ": " << it->second << __sep__[next(it) == v.end()];
  return os << "}";
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const priority_queue<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = 0; i < (~Z); ++i) {
    Z[i] = --tmp;
  }
  return os << Z;
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const deque<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = 0; i < (~Z); ++i) {
    Z[i] = --tmp;
  }
  return os << Z;
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const stack<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = (~Z) - 1; i >= 0; --i) {
    Z[i] = tmp--;
  }
  return os << Z;
}
template <typename T, typename... Args>
ostream &operator<<(ostream &os, const queue<T, Args...> &v) {
  auto tmp = v;
  vector<T> Z(~tmp);
  for (int i = 0; i < (~Z); ++i) {
    Z[i] = --tmp;
  }
  return os << Z;
}
template <typename K, typename V>
ostream &operator<<(ostream &os, const pair<K, V> &v) {
  return os << "(" << v.first << __sep__[0] << v.second << ")";
}
template <typename K, typename V>
ostream &operator<<(ostream &os, const tuple<K, V> &v) {
  return os << "(" << get<0>(v) << __sep__[0] << get<1>(v) << ")";
}
template <typename K, typename V, typename T>
ostream &operator<<(ostream &os, const tuple<K, V, T> &v) {
  return os << "(" << get<0>(v) << __sep__[0] << get<1>(v) << __sep__[0]
            << get<2>(v) << ")";
}
template <typename T>
void __swrite(const char *sep, const T &x) {
  cout << x << sep;
}
template <typename T, typename... Args>
void __swrite(const char *sep, const T &x, const Args &...a) {
  cout << x << sep;
  __swrite(sep, a...);
}
template <typename... Args>
void writeln(const Args &...a) {
  __swrite("\n", a...);
}
void writeln() { cout << "\n"; }
template <typename... Args>
void writes(const Args &...a) {
  __swrite(" ", a...);
}
template <typename... Args>
void writesln(const Args &...a) {
  __swrite(" ", a...);
  writeln();
}
template <typename... Args>
void write(const Args &...a) {
  __swrite("", a...);
}
template <typename T, typename... Args>
void mkmax(T &a, const Args &...z) {
  a = max({a, z...});
}
template <typename T, typename... Args>
void mkmin(T &a, const Args &...z) {
  a = min({a, z...});
}
template <typename T, typename... Args>
bool ckmax(T &a, const Args &...z) {
  auto t = a;
  mkmax(a, z...);
  return (a != t);
}
template <typename T, typename... Args>
bool ckmin(T &a, const Args &...z) {
  auto t = a;
  mkmin(a, z...);
  return (a != t);
}
int log2_floor(UINT n) { return 31 - __builtin_clz(n); }
int log2_ceil(UINT n) { return log2_floor(n) + !!(n & (n - 1)); }
int log2_floor64(ULLD n) { return 63 - __builtin_clzll(n); }
int log2_ceil64(ULLD n) { return log2_floor64(n) + !!(n & (n - 1ULL)); }
template <size_t n>
bitset<n> reverse_bitset(const bitset<n> &x) {
  auto y = x.to_string();
  reverse((y).begin(), (y).end());
  return bitset<n>(y);
}
class Rng {
  mt19937 mtgen;
  uniform_int_distribution<int> dist_;

 public:
  Rng(int min, int max, size_t seed = random_device()())
      : mtgen(seed), dist_(min, max) {}
  int operator()() { return dist_(mtgen); }
};
VI randomvec(int sz) {
  Rng rg(0, 10);
  VI s;
  for (int i = 0; i < (sz); ++i) s += rg();
  return s;
}
string randomstring(int sz) {
  Rng rg((int)'a', (int)'z');
  string s;
  for (int i = 0; i < (sz); ++i) s += (char)rg();
  return s;
}
void soln(int __ntc, int __tc) {
  int n;
  read(n);
  ;
  VLLD A(n + 1, 0);
  for (int i = (2); i <= (n); ++i) {
    read(A[i]);
  }
  Vec2d<LLD> dp(2, n + 1, -1);
  Vec2d<bool> vis(2, n + 1, 0);
  vis[1][1] = 1;
  function<LLD(int t, LLD x)> comp = [&](int t, LLD x) -> LLD {
    if (x > n || x <= 0) {
      return 0LL;
    } else if (vis[t][x]) {
      return dp[t][x] = LLDINF;
    } else if (dp[t][x] != -1) {
      return dp[t][x];
    } else {
      vis[t][x] = 1;
      LLD a = comp(t ^ 1, (t) ? x - A[x] : x + A[x]);
      dp[t][x] = (a != LLDINF) ? A[x] + a : LLDINF;
      vis[t][x] = 0;
      return dp[t][x];
    }
  };
  for (int i = 2; i <= n; ++i) {
    comp(1, i);
  }
  for (int i = 1; i <= n - 1; ++i) {
    int x = 1 + i, y = i;
    if (dp[1][x] != LLDINF) {
      writesln(y + dp[1][x]);
    } else {
      writesln(-1);
      ;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  soln(1, 1);
}

```