Problem H: 回文质数

Problem H: 回文质数

[Creator : ]
Time Limit : 1000.000 sec  Memory Limit : 64 MB

Description

因为151即是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以 151 是回文质数。 写一个程序来找出大过a的最小的回文质数。

Input

第 1 行: 一个整数 a .(a<100000)

Output

输出一个回文质数。

Sample Input Copy

10301

Sample Output Copy

10501