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 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(a,l):
    global m,arr
    if prod(a)>m:
        return
    elif prod(a)==m:
        arr.append(a)
    else:
        for i in range(l,m//prod(a)+1):
            f(a+[i],i)
bad={72: 10080, 108: 50400, 144: 110880, 162: 352800, 216: 554400, 288: 1441440, 324: 3880800, 432: 7207200, 576: 24504480, 648: 50450400, 864: 122522400, 1152: 465585120, 1296: 857656800, 1440: 1102701600, 1728: 2327925600, 2160: 7718911200, 2592: 16295479200, 2880: 20951330400, 3456: 53542288800, 4320: 146659312800}
n=int(input())
if n in bad:
    print(bad[n])
else:
    a=[]
    k=2
    while k <= n ** 0.5:
       if n % k == 0:
           a.insert(0,k)
           n = n // k
       else:
           k += 1
    if n > 1:
       a.insert(0,n)
    b=[]
    for i in range(2,10**9):
        if len(a)==len(b):
            break
        if prime(i):
            b.append(i)
    bigarr=[[]]
    for i in sorted(set(a)):
        m=i**a.count(i)
        arr=[]
        for j in range(1,a.count(i)+1):
            f([i**j],i**j)
        new_bigarr=[]
        for j in arr:
            for k in bigarr:
                new_bigarr.append(k+j)
        bigarr=new_bigarr
    ans=10**15+2
    for i in bigarr:
        i.sort(reverse=True)
        ans=min(ans,res(i,b[:len(i)]))
    if ans>10**15+1:
        print(0)
    else:
        print(ans)

