#include <bits/stdc++.h>
using namespace std;
int gcd(int n, int m) {
  while (m) {
    int t = n % m;
    n = m;
    m = t;
  }
  return n;
}
int main() {
  int cas, n;
  scanf("%d", &cas);
  while (cas--) {
    scanf("%d", &n);
    int d = gcd(4, n + 1);
    long long y = 1;
    y = y * (n + 1) / d;
    long long ans = 4 * y * n / (n + 1);
    cout << ans + 1 << endl;
  }
  return 0;
}
