import sys INF = float('inf') #10**20,2**63,float('inf') MOD = 10**9 + 7 MOD2 = 998244353 #from collections import defaultdict def solve(): def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LC(): return list(input()) def IC(): return [int(c) for c in input()] def MI(): return map(int, sys.stdin.readline().split()) """ import math def my_lcm(x, y): return (x * y) // math.gcd(x, y) lcm = 1 for n in range(2,50): lcm = my_lcm(lcm,n) print(lcm) """ T = II() for _ in range(T): X = II() if X==1: print(2) continue for n in range(2,50): if X%n != 0: print(X*n) break return solve() #sys.setrecursionlimit(10 ** 6)#再帰関数ではコメントにしないこと!!