#include using namespace std; using ll = long long; constexpr char newl = '\n'; template vector sieve(T n) { vector res; vector is_prime(n + 1, true); is_prime[0] = false; is_prime[1] = false; for (T i = 2; i <= n; i++) { if (!is_prime[i]) continue; res.emplace_back(i); for (T j = 2 * i; j <= n; j += i) is_prime[j] = false; } return res; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); vector v = sieve(200000); int n; cin >> n; if (n == 1) { cout << 1 << newl; return 0; } --n; int ans = 100000; for (int i = 0; i < n; i++) { ans = *upper_bound(v.begin(), v.end(), ans); } cout << ans << newl; return 0; }