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