#include <iostream>
using namespace std;
int n, d[7000009];
int main() {
	cin >> n;
	for (int i = 1; i <= 7000000; i++) {
		for (int j = i; j <= 7000000; j += i) {
			d[j]++;
		}
	}
	int cnt = 0;
	for (int i = 1; i <= 7000000; i++) {
		if (d[i] == 4) cnt++;
		if (cnt == n) {
			cout << i << endl;
			break;
		}
	}
	return 0;
}