#include <bits/stdc++.h>
using namespace std;
int hcf(long long a, long long b) {
  if (b == 0) return a;
  return hcf(b, a % b);
}
void solve() {
  long long n;
  cin >> n;
  long long x = hcf(n + 1, 4 * n);
  long long lcm = ((4 * n) * (n + 1)) / x;
  cout << lcm / (n + 1) + 1;
}
int main() {
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
