1474_B. Different Divisors
Positive integer x is called divisor of positive integer y, if y is divisible by x without remainder. For example, 1 is a divisor of 7 and 3 is not divisor of 8.

We gave you an integer d and asked you to find the smallest positive integer a, such that 

  * a has at least 4 divisors; 
  * difference between any two divisors of a is at least d.

Input

The first line contains a single integer t (1 ≤ t ≤ 3000) — the number of test cases.

The first line of each test case contains a single integer d (1 ≤ d ≤ 10000).

Output

For each test case print one integer a — the answer for this test case.

Example

Input


2
1
2


Output


6
15

Note

In the first test case, integer 6 have following divisors: [1, 2, 3, 6]. There are 4 of them and the difference between any two of them is at least 1. There is no smaller integer with at least 4 divisors.

In the second test case, integer 15 have following divisors: [1, 3, 5, 15]. There are 4 of them and the difference between any two of them is at least 2.

The answer 12 is INVALID because divisors are [1, 2, 3, 4, 6, 12]. And the difference between, for example, divisors 2 and 3 is less than d=2.
```python
# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase


BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
if os.path.exists('input.txt'):
    sys.stdin = open('input.txt','r')
    sys.stdout = open('output.txt','w')


# ------------------- fast io --------------------
from math import *
from itertools import * # chain,groupby,permutations,combinations
from collections import Counter
from bisect import *

"""
def prod(a, mod=10**9+7):
    ans = 1
    for each in a:
        ans = (ans * each) % mod
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y


def powerset(s):
    n=len(s)
    
    return chain.from_iterable(combinations(s,r) for r in range(1,n))

def binarySearch(arr,x): 
    l=0
    r=len(arr)-1
    while l <= r: 
  
        mid = l + (r - l) // 2; 
        if arr[mid] == x: 
            return mid 
        elif arr[mid] < x: 
            l = mid + 1
        else: 
            r = mid - 1
    return -1

def prime(): #array of prime numbers
    arr = [1]*10000
    for i in range(10000):
        if i==0:
            arr[i]=0
        elif i==1:
            arr[i]=0
        else:
            if not arr[i]:
                continue
            j=i
            for k in range(2,10000):
                if j*k>=len(arr):
                    break
                arr[j*k]=0
    return arr

def isprime(x):
    i=2
    while i*i<=x:
        if x%i==0:
            return 0
        i+=1
    return 1

"""

#----#



def aa(): #for int
    return(int(input()))
def bb(): #for int arr
    return(list(map(int,input().split())))
def cc():  #for string
    s = input()
    return s#(list(s))
def dd(): #space seperated intege
    return(map(int,input().split()))
#----#

def isprime(x):
    i=2
    while i*i<=x:
        if x%i==0:
            return 0
        i+=1
    return 1


def solve():
    d=aa()
    n=d+1
    while not isprime(n):
        n+=1
    b=d+n
    while not isprime(b):
        b+=1
 
    print(min(n**3,n*b))
    
    





         
if __name__ == "__main__":
    t=aa()
    while(t):
        solve()
        t-=1

"""

_________            .___.__                           _________.__ __   .__                          .___                      .__                 
\_   ___ \  ____   __| _/|__| ____    ____            /   _____/|__|  | _|  |__ _____               __| _/____           ______ |  |   ______ ______
/    \  \/ /  _ \ / __ | |  |/    \  / ___\           \_____  \ |  |  |/ /  |  \\__  \             / __ |/  _ \          \____ \|  |  /  ___//  ___/
\     \___(  <_> ) /_/ | |  |   |  \/ /_/  >          /        \|  |    <|   Y  \/ __ \_          / /_/ (  <_> )         |  |_> >  |__\___ \ \___ \ 
 \______  /\____/\____ | |__|___|  /\___  /__________/_______  /|__|__|_ \___|  (____  /__________\____ |\____/__________|   __/|____/____  >____  >
        \/            \/         \//_____/_____/_____/       \/         \/    \/     \/_____/_____/    \/    /_____/_____/__|             \/     \/ 

"""
```