#include <bits/stdc++.h>
using namespace std;
long long GCD(long long a, long long b);
long long LCM(long long m, long long n);
int main() {
  long long testCase, t, n, result;
  cin >> testCase;
  for (t = 1; t <= testCase; t++) {
    cin >> n;
    result = LCM(4 * n, n + 1);
    result = result / (n + 1) + 1;
    cout << result << endl;
  }
  return 0;
}
long long GCD(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long LCM(long long m, long long n) {
  long long gcd, lcm;
  gcd = GCD(m, n);
  lcm = (m * n) / gcd;
  return lcm;
}
