Under construction

Still being built. Things may change

Message

Interview

Time limit2sMemory limit1024 MB

Summary
Given k, find the k-th smallest prime p such that 2p + 1 is also prime.
Level

Easy3 of 10

Topics
Number theory, Implementation
Solved
No attempts yet

Problem

Petya and Vasya keep playing spies. This time Petya sent Vasya an encoded message. The two keys for decoding it are prime numbers pp and qq. Petya told Vasya that these numbers satisfy q=2p+1q = 2p + 1, and that pp is the kk-th smallest prime for which such a prime qq exists.

Help Vasya read the message by finding this pp.

Input

The only line of the input file contains an integer kk (1≤k≤300001 \le k \le 30000), the ordinal number of pp.

Output

Print the single number pp to the output file.

Examples2

  1. Example 1

    Input
    1
    
    Expected output
    2
    
  2. Example 2

    Input
    4
    
    Expected output
    11