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