#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long int b) {
  while (b) b ^= a ^= b ^= a %= b;
  return a;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    long long x = ((n + 1) * 4 * n) / gcd(n + 1, 4 * n);
    x = x / (n + 1);
    cout << x + 1 << endl;
  }
  return 0;
}
