Kth Prime Number

Time limit2sMemory limit256 MB

Summary
Given K up to 500,000, print the K-th prime number.
Level

Easy3 of 10

Topics
Number theory, Math, Implementation
Solved
No attempts yet

Problem

The following is part of a conversation between Hangyeol and a mirror.

  • Hangyeol: No matter how I think about it, I'm pretty sure I have a good memory!
  • Mirror: Have you no shame?
  • Hangyeol: You don't believe me? That's ridiculous lol
  • Mirror: lolololololol
  • Hangyeol: Hah.. you don't believe me; right now every prime number is inside my head in order? I'll tell you the prime number of whatever position you want.
  • Mirror: Then what's the kth prime number??
  • Hangyeol: The kth prime number is....

Honestly, Hangyeol's memory is trash. That's why he can't actually memorize the primes. But now that he has bragged like this, he wants to give the mirror a proper lesson. Let's help Hangyeol and tell the kth prime number.

The definition of a prime number is as follows.

A natural number N of 2 or more is called a prime number when it is not divisible by any natural number other than 1 and N.

Input

A natural number K is given. (1 ≤ K ≤ 500,000)

Output

Print the Kth prime number.

Examples2

  1. Example 1

    Input
    1
    
    Expected output
    2
    
  2. Example 2

    Input
    3
    
    Expected output
    5