#include <bits/stdc++.h>
using namespace std;
int main() {
  long long Test_Case, Xnum;
  bool check;
  cin >> Test_Case;
  for (long long i = 0; i < Test_Case; i++) {
    cin >> Xnum;
    if (Xnum % 2 == 0) {
      cout << (Xnum * 4) + 1 << endl;
    } else {
      if ((Xnum + 1) % 4 == 0)
        cout << Xnum + 1 << endl;
      else
        cout << (Xnum * 2) + 1 << endl;
    }
  }
  return 0;
}
