#include <bits/stdc++.h>
using namespace std;
long long n, t;
long long lcm(long long a, long long b) {
  long long a1 = a, b1 = b;
  while (a != 0 && b != 0) {
    if (a > b)
      a %= b;
    else
      b %= a;
  }
  return a1 * b1 / max(a, b);
}
int main() {
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n;
    cout << 1 + lcm(4 * n, n + 1) / (n + 1) << "\n";
  }
  return 0;
}
