Wonderful!
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
A number is called wonderfully-prime if it is a prime number (only divisible by itself and 1), and when its digits are reversed, the resulting number is also prime. Your task is to output the K-th wonderfully-prime number. If this number exceeds 10^6, output -1.
Input
The input consists of a single integer K (1 ≤ K ≤ 1000).
Output
The output should be a single integer, which is the answer to the problem.
Examples
Input #1
Answer #1
Submissions 466
Acceptance rate 34%