Stefan calls a positive integer lucky prime, if and number p_1, obtained by reversing its decimal notation, i.e. reading all digits from end to beginning, are distinct primes.
Remind that positive integer is prime, if it has no positive integer divisors except for and itself.
Given , find -th lucky prime.
First line of the input contains one integer (1 \leq K \leq 1000).
If -th lucky prime is not greater than 10^6, print it. Otherwise print .
Example 1