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).
# https://codeforces.com/problemset/problem/27/E

from itertools import count


MAX = 10 ** 18


def gen_primes(max_size):
    result = []
    for i in count(2):
        if any(i % p == 0 for p in result):
            continue
        result.append(i)
        if len(result) >= max_size:
            return result


def solve(value):
    dp = [MAX] * (value + 1)
    for i, _ in enumerate(dp[:-1]):
        if 2 ** i > MAX:
            break
        dp[i + 1] = 2 ** i
    primes = gen_primes(10)
    for i, _ in enumerate(dp):
        for j in count(2):
            if j * j > i:
                break
            if i % j == 0:
                k = dp[i // j]
                q = next(p for p in primes if k % p != 0)
                dp[i] = min(dp[i], dp[i // j] * q ** (j - 1))
    return dp[-1]


if __name__ == '__main__':
    value = int(input())
    print(solve(value))
