#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned long long t;
  cin >> t;
  for (int ti = (int)(0); ti < (int)(t); ti++) {
    unsigned long long n;
    cin >> n;
    if (n % 2) {
      unsigned long long tmp = (n + 1u) * n;
      unsigned long long res;
      if (tmp % (4u * n) == 0) {
        res = n;
      } else if (tmp % (4u * n) == 2u * n) {
        res = n * 2u;
      } else {
        res = n * 4u;
      }
      cout << res + 1u << endl;
    } else {
      cout << n * 4u + 1 << endl;
    }
  }
  return 0;
}
