#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<long long> ans;
  long long a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    long long temp2 = (a * (a + 1));
    if (a % 4 == 0 || a % 4 == 2) {
      ans.push_back(((temp2 * 4) / (a + 1)) + 1);
    } else if (a % 4 == 1) {
      ans.push_back(((temp2 * 2) / (a + 1)) + 1);
    } else
      ans.push_back((temp2 / (a + 1)) + 1);
  }
  for (auto c : ans) {
    cout << c << endl;
  }
  return 0;
}
