import sys
t=int(input())
data=sys.stdin.read().strip().split()
for i in range(t):
n=int(data[i])
if n%3==0:
print(2*n)
else:
print(n)