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 = 1003
n = int(input())
dp = [[1000000000000000 for i in range(N)] for j in range(62)]
primes = []
for i in range(2, 1000):
	if(len(primes) > 62):
		break
	flag = True
	for j in range(2, i):
		if(i % j == 0):
			flag = False
			break
	if(flag):
		primes.append(i)


for i in range(1, n + 1):
	dp[0][i] = min(dp[0][i], 2**(i - 1))

for i in range(1, 5):
	for j in range(1, n + 1):
		dp[i][j] = dp[i - 1][j]
		for k in range(0, j + 1):
			if(j % (k + 1) != 0):
				continue
			dp[i][j] = min(dp[i][j], dp[i - 1][j//(k + 1)]*primes[i]**k)
print(dp[4][n])