n = int(input())
def gcd(a,b):
r = 0
while b!=0:
r = a%b
a = b
b = r
return a
def answer(n):
d = gcd(4*n,n+1)
ans = 4*n//d
return ans+1
m = [int(j) for j in input().split()]
for i in range(n):
num = m[i]
print(answer(num))