Given the number *n*, find the smallest positive integer which has exactly *n* divisors. It is guaranteed that for the given *n* the answer will not exceed 10<sup class="upper-index">18</sup>.
The first line of the input contains integer *n* (1 ≤ *n* ≤ 1000).
def delit(a) :
    res = []
    i = 1
    while i * i < a + 1 :
        if a % i == 0 :
            temp = [i, a // i]
            res.append(temp)
        i += 1
    return res 
    
n = int(input())
npr = [2,3,5,7,11,13,17,19,23,29]
fact = delit(n)
flen = len(fact)
while True :
    for j in range(flen) :
        zero = 1
        if not (1 in fact[j]) :
            zero = 0
            n1 = fact.pop(j)
            factj = delit(n1.pop())
            for k in range(len(factj)) :
                factj[k].extend(n1)
                fact.append(factj[k])
        flen = len(fact)
    if zero == 1:
        break
for ik in fact :
    ik.sort(reverse=True)
    if ik[-1] == 1 and len(ik) > 2:
        ik.pop()
fact.sort()
j =[0]
resj = []
for i in fact :
    if i != j :
        resj.append(i)
    j=i
    minc = int(1e300)
for i in resj :
    j = 0
    ss = 1
    for ii in i:
        ss *= npr[j] ** (ii-1)
        j += 1
    minc = min(minc,ss)

#print(len(resj))
print(minc)