#include <iostream>
#include <cmath>
#include <vector>
#include <string.h>
#include <bits/stdc++.h>
#include <cstdlib>
#include <time.h>
#include <fstream>
#include <iterator>
#include <utility>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
using namespace std;
#define ll long long
#define ld long double
typedef vector<int> vi;
typedef vector<ll> vill;
#define all(v) ((v).begin()), ((v).end())
#define sz(v) ((ll)((v).size()))
#define vinp(v, n) \
for (ll i = 0; i < (n); i++) \
cin >> (v)[i]
#define printv(v) \
for (auto i : (v)) \
cout << i << " "
#define Bustany \
; \
ios::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define loop(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define _CRT_SECURE_NO_WARNING
const ll MOD = 1000000007;
void solve()
{
ll n;
cin >> n;
priority_queue<ll,vill,greater<ll>> p;
set<ll> s;
s.insert(1);
p.push(1);
ll ugly=1;
for (int i = 1; i < n; i++)
{
ugly = p.top();
p.pop();
if (s.find(ugly * 2) == s.end())
{
s.insert(ugly * 2);
p.push(ugly * 2);
}
if (s.find(ugly * 3) == s.end())
{
s.insert(ugly * 3);
p.push(ugly * 3);
}
if (s.find(ugly * 5) == s.end())
{
s.insert(ugly * 5);
p.push(ugly * 5);
}
}
cout << p.top();
}
int main()
{
Bustany int t = 1;
// cin >> t;
while (t--)
{
solve();
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxzdHJpbmcuaD4KI2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxjc3RkbGliPgojaW5jbHVkZSA8dGltZS5oPgojaW5jbHVkZSA8ZnN0cmVhbT4KI2luY2x1ZGUgPGl0ZXJhdG9yPgojaW5jbHVkZSA8dXRpbGl0eT4KI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPHNldD4KI2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPGJ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ChzLmZpbmQodWdseSAqIDIpID09IHMuZW5kKCkpCiAgICAgICAgewogICAgICAgICAgICBzLmluc2VydCh1Z2x5ICogMik7CiAgICAgICAgICAgIHAucHVzaCh1Z2x5ICogMik7CiAgICAgICAgfQogICAgICAgIGlmIChzLmZpbmQodWdseSAqIDMpID09IHMuZW5kKCkpCiAgICAgICAgewogICAgICAgICAgICBzLmluc2VydCh1Z2x5ICogMyk7CiAgICAgICAgICAgIHAucHVzaCh1Z2x5ICogMyk7CiAgICAgICAgfQogICAgICAgIGlmIChzLmZpbmQodWdseSAqIDUpID09IHMuZW5kKCkpCiAgICAgICAgewogICAgICAgICAgICBzLmluc2VydCh1Z2x5ICogNSk7CiAgICAgICAgICAgIHAucHVzaCh1Z2x5ICogNSk7CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCBwLnRvcCgpOwp9CgppbnQgbWFpbigpCnsKICAgIEJ1c3RhbnkgaW50IHQgPSAxOwogICAgLy8gY2luID4+IHQ7CiAgICB3aGlsZSAodC0tKQogICAgewogICAgICAgIHNvbHZlKCk7CiAgICB9Cn0=