#include <bits/stdc++.h>
using namespace std;
template <typename... T>
void read(T &...args) {
  ((cin >> args), ...);
}
template <typename... T>
void write(T... args) {
  ((cout << args), ...);
}
using vcl = vector<long>;
using vcc = vector<char>;
using vcs = vector<string>;
using vcd = vector<double>;
using vcll = vector<long long>;
using vc = vector<int>;
using si = set<int>;
using sll = set<long long>;
using sl = set<long>;
using sc = set<char>;
using ss = set<string>;
void printV(vcll &v) {
  for (auto i : v) write(i, " ");
}
int main() {
  int t;
  read(t);
  while (t--) {
    long long n;
    read(n);
    if (n % 2 == 0)
      write(4 * n + 1, "\n");
    else {
      if ((n + 3) % 4 == 0)
        write(2 * n + 1, "\n");
      else
        write(n + 1, "\n");
    }
  }
}
