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