N=int(input()) for i in range(N): d=int(input()) for j in range(2,10000): if d%j!=0: print(j*d) break