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 ddd(x, fact):
    fact.append(x)
    for i in range(2, int(x ** (1 / 2))+1):
        if x % i == 0:
            if i**2==x:
                fact.append(i)
            else:
                fact.append(i)
                fact.append(x//i)
            ddd(i, fact)

x = int(input())
fact = [1, 1, 1, 1]
ddd(x, fact)
pp = len(fact)
ma = 123456787654323456765432
fact.sort()
for a in range(pp):
    for b in range(a + 1, pp):
        for c in range(b + 1, pp):
            for d in range(c + 1, pp):
                if fact[a] * fact[b] * fact[c] * fact[d] == x:
                    ma = min((2 ** (fact[d] - 1) * 3 ** (fact[c] - 1) * 5 ** (fact[b] - 1) * 7 ** (fact[a] - 1)), ma)
print(ma)
