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).
x=int(input())

# 素因数分解
import math 
L=int(math.sqrt(x))

FACT=dict()

for i in range(2,L+2):
    while x%i==0:
        FACT[i]=FACT.get(i,0)+1
        x=x//i

if x!=1:
    FACT[x]=FACT.get(x,0)+1


x=10**5
import math 
L=math.floor(math.sqrt(x)) # 平方根を求める

Primelist=[i for i in range(x+1)]
Primelist[1]=0 # 1は素数でないので0にする.
 
for i in Primelist:
    if i>L:
        break
    if i==0:
        continue
    for j in range(2*i,x+1,i):
        Primelist[j]=0

Primes=[Primelist[j] for j in range(x+1) if Primelist[j]!=0]

X=[]
for f in FACT:
    X+=[f]*FACT[f]

X.sort(reverse=True)

def calc(X,now):
    if len(X)==0:
        return 1

    ANS=10**18
    LEN=len(X)
    for i in range(1,1<<LEN):
        plus=1
        for j in range(LEN):
            if i & (1<<j) != 0:
                plus*=X[j]

                if plus>40:
                    break
        if plus<=40:
            Y=[]

            for j in range(LEN):
                if i & (1<<j) == 0:
                    Y.append(X[j])

            ANS=min(ANS,calc(tuple(Y),now+1)*(Primes[now]**(plus-1)))

    return ANS

print(calc(tuple(X),0))
            
            
        
    
