#include <bits/stdc++.h>
using namespace std;
vector<long long> nn;
long long a;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  long long num;
  cin >> num;
  while (num--) {
    long long step;
    cin >> a;
    step = a + 1;
    long long line;
    line = (4 * (step - 1));
    nn.push_back(((step * line) / gcd(step, line) / step) + 1);
  }
  for (long long i = 0; i < nn.size(); i++) cout << nn[i] << endl;
  return 0;
}
