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).
from math import *
def prime(n):
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            return 0
    return 1
def res(a,b):
    k=1
    for i in range(len(a)):
        k*=b[i]**(a[i]-1)
    return k
def prod(a):
    k=1
    for i in a:
        k*=i
    return k
def f(s,l):
    global m,arr,x
    a=list(map(int,s.split('*')))
    if prod(a)>m:
        return 
    elif prod(a)==m:
        arr.append(a)
    else:
        for i in range(l,m//prod(a)+1):
            if log(i,x)==int(log(i,x)):
                f(s+f'*{i}',i)
n=int(input())
a=[]
k=2
while k <= n ** 0.5:
   if n % k == 0:
       a.append(k)
       n = n // k
   else:
       k += 1
if n > 1:
   a.append(n)
b=[]
for i in range(2,10**5):
    if len(a)==len(b):
        break
    if prime(i):
        b.append(i)
a.reverse()
ans=res(a,b)
if len(a)>1 and len(set(a))==1:
    m=prod(a)
    x=a[0]
    arr=[]
    for i in range(1,int(log(m,x))+1):
        f(f'{x**i}',x**i)
    for i in arr:
        ans=min(ans,res(i[::-1],b[:len(i)]))
if ans>=10**15+1:
    print(0)
else:
    print(ans)