#include <bits/stdc++.h>
int main() {
  int cases, n;
  scanf("%d", &cases);
  while (cases--) {
    scanf("%d", &n);
    if (n & 1) {
      int v = n / 2;
      if (v & 1)
        printf("%d\n", n + 1);
      else
        printf("%d\n", 2 * n + 1);
    } else
      printf("%I64d\n", (long long)4 * n + 1);
  }
}
