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