Welcome to ZOJ
Information
Problems
Runs
Statistics
Ranklist
Clarification
69 - ZOJ Monthly, August 2008 - 1001
9875321

Time Limit: 2 Seconds      Memory Limit: 65536 KB

Recently, DD found that 9875321 was a very special number, and it has three properties:

(1) 9875321 is a prime number.
(2) reverse it, we get 1235789, which is also a prime number.
(3) the digits of 9875321 are in strictly descreasing order.

Above all, for all the decimal numbers with the three properties, 9875321 is the maximal one. So we say 9875321 is very special.

Now, given N (2<=N<=16), find the N-based very special number. For N>10, we use capitals 'A', 'B', 'C'...

Input

Each line of input is a test case, which consists of only one number N.

Output

For each line of input you will output only one line for the N-band very special number. If the N-band very special number doesn't exist, output "not special".

Sample Input
3
10

Sample Output
21
9875321

Author: CUI, Tianyi


Submit    Status