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