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 collections import defaultdict
import sys


def input():
    return sys.stdin.readline().rstrip()

mod = 998244353
inf = 1 << 64


def DIVISORS(M, sorted=True):
    res = []
    for i in range(1, M + 1):
        if i * i > M:
            break
        if M % i == 0:
            res.append(i)
            res.append(M//i)
    res = list(set(res))
    if sorted:
        res.sort()
    return res


def PRIME_SIEVE(M):
    '''
    return PRIME_LIST[0,M]
    '''
    isprime = [True]*(M + 1)
    primes = []
    isprime[0] = isprime[1] = False
    for i in range(2, M + 1):
        if isprime[i]:
            primes.append(i)
            for j in range(i*i, M + 1, i):
                isprime[j] = False
    return primes


P = PRIME_SIEVE(1000)
K = int(input())
D = DIVISORS(K)
memo = defaultdict(int)


def dfs(N: int, pos: int):
    if (N, pos) in memo:
        return memo[(N, pos)]
    ans = inf

    if N == 1:
        memo[(N, pos)] = 1
        return 1
    
    for d in D:
        if 100 > d > 1 and N % d == 0:
            cand = dfs(N // d, pos + 1) * pow(P[pos], d - 1)
            if cand <= 10 ** 9:
                ans = min(ans, cand)
    
    memo[(N, pos)] = ans
    return ans

ans = dfs(K,0)
print(ans)