#include
using namespace std;
typedef long long dint; #ifdef WIN32 #define lld “%I64d” #else #define lld “%lld” #endif #define _l (long long int)
const int maxp = 300009; const dint maxv = 1e11;
int pn[maxp], tp; bool pr[maxp]; dint qv, x, cnt;
void pre() { memset(pr, 0, sizeof(pr)); tp = 0; for (int i = 2; i < maxp; ++ i) { if (!pr[i]) pn[tp ++] = i; for (int j = 0; j < tp && i * pn[j] < maxp; ++ j) { pr[i * pn[j]] = 1; if (i % pn[j] == 0) break; } } }
void dfs(int pi, dint cv, int sgn) { cnt += (qv / cv) * sgn; if (pi == tp) return; for (int i = pi; i < tp; ++ i) { dint nv(cv * pn[i]); if (nv > qv) break; nv *= pn[i]; if (nv > qv) break; dfs(i + 1, nv, -sgn); } }
int main() { #ifndef ONLINE_JUDGE freopen(“in.txt”, “r”, stdin); #endif
pre();
dint l(1), r(maxv);
scanf(lld, &x);
while (l < r) {
qv = (l + r) >> 1;
cnt = 0;
dfs(0, 1, 1);
if (qv - cnt < x)
l = qv + 1;
else
r = qv;
}
printf(lld "\n", l);
}