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).
n = int(input())

primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353]
factors = []
for p in primes:
    while n % p == 0:
        factors.append(p)
        n //= p
    if n < p:
        break
if n > 1:
    factors.append(n)
# print(factors)
factors.sort(reverse=True)

dp = {tuple()}
for f in factors:
    ndp = set()
    for b in dp:
        buf = list(b)
        for i in range(len(buf)):
            ndp.add(tuple(sorted(buf[:i] + [buf[i] * f] + buf[i+1:], reverse=True)))
        buf.append(f)
        buf.sort(reverse=True)
        ndp.add(tuple(buf))
    dp = ndp

# print(dp)
                    
result = 1 << 1024
for combine in dp:
    test = 1
    for i, f in enumerate(combine):
        test *= primes[i] ** (f - 1)
    result = min(result, test)
print(result)