Wonderful!#3357

Wonderful!

1 saniye
64 megabayt
Çok kolay

A number is called wonderfully-prime if it is a prime number (only divisible by itself and ), and when its digits are reversed, the resulting number is a different prime number. Your task is to output the -th wonderfully-prime number. If this number exceeds 10^6, output .

Giriş

The input consists of a single integer (1 \le K \le 1000).

Çıktı

The output should be a single integer, which is the answer to the problem.

Örnekler

Örnek 1

Loading
Loading