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):
    primes = gen_primes(10)

    def dfs(n, level):
        if n == 1:
            return 1
        result = MAX
        p = primes[level]
        for d in range(2, n + 1):
            front = p ** (d - 1)
            if MAX < front:
                break
            if n % d == 0:
                result = min(result, front * dfs(n // d, level + 1))
        return result

    return dfs(value, 0)


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