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