#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else {
    return (gcd(b, (a % b)));
  }
}
int main() {
  int t;
  long long n;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) {
    cin >> n;
    long long a = (long long)4LL * n;
    long long b = (long long)(n + 1LL);
    long long res = gcd(a, b);
    res = (long long)(a) / res;
    cout << (res + 1) << endl;
  }
  return 0;
}
