#include #include #include using namespace std; int f235(int n) { queue q2; q2.push(2); queue q3; q3.push(3); queue q5; q5.push(5); int x = 1; while (n--) { x = min({ q2.front(), q3.front(), q5.front() }); q2.push(2 * x); q3.push(3 * x); q5.push(5 * x); if (q2.front() == x) q2.pop(); if (q3.front() == x) q3.pop(); if (q5.front() == x) q5.pop(); } return x; } int main(void) { int n; cin >> n; cout << f235(n) << endl; return 0; }