#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, t;
  cin >> t;
  while (t--) {
    cin >> n;
    if (n % 2 == 0) {
      cout << (4 * n) + 1 << endl;
    } else if (n % 4 == 3) {
      cout << n + 1 << endl;
    } else if (n % 4 == 1) {
      cout << (n * 2) + 1 << endl;
    }
  }
  return 0;
}
