#include <bits/stdc++.h>
using namespace std;
int main() {
  int cases;
  int ic;
  cin >> cases;
  for (ic = 0; ic < cases; ic++) {
    long long n;
    long long sum, mod;
    long long counter;
    int i;
    long long k;
    cin >> n;
    sum = 0;
    counter = 0;
    i = 1;
    do {
      k = i * n;
      i++;
      sum = k * (n + 1);
      counter = k;
      mod = sum % (4 * n);
    } while (mod != 0);
    cout << counter + 1 << endl;
  }
  return 0;
}
