#include <bits/stdc++.h>
using namespace std;
void yo() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  cout << fixed;
}
int main() {
  yo();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    if (n == 1)
      cout << 3 << "\n";
    else {
      if (n % 2) {
        long long x = (n + 4 - 1) / 4;
        if ((x * 4) - 1 == n)
          cout << n + 1 << "\n";
        else
          cout << 2 * n + 1 << "\n";
      } else
        cout << 4 * n + 1 << "\n";
    }
  }
  return 0;
}
