#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  unsigned int t, i, k;
  cin >> t;
  unsigned long long n, j, count;
  for (i = 0; i < t; i++) {
    cin >> n;
    if (n % 2 == 0) {
      cout << (n * 4) + 1 << endl;
    } else {
      if ((n - 1) % 4 == 0)
        cout << n * 2 + 1 << endl;
      else
        cout << n + 1 << endl;
    }
  }
  return 0;
}
