10152 - 回文质数

因为151即是一个质数又是一个回文数(从左到右和从右到左是看一样的),所以 151 号是回文质数。 写一个程序来找出范围[a,b](5 <= a < b <= 100,000,000)间的所有回文质数;

Input

第 1 行: 二个整数 a 和 b .

Output

输出一个回文质数的列表,一行一个。

Examples

Input

5 500

Output

5
7
11
101
131
151
181
191
313
353
373
383

Hint

Prime Palindromes The number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime palindromes in the range of two supplied numbers a and b (5 <= a < b <= 100,000,000); both a and b are considered to be within the range .

PROGRAM NAME: pprime INPUT FORMAT Line 1: Two integers, a and b

SAMPLE INPUT (file pprime.in) 5 500

OUTPUT FORMAT The list of palindromic primes in numerical order, one per line. SAMPLE OUTPUT (file pprime.out) 5 7 11 101 131 151 181 191 313 353 373 383

HINTS (use them carefully!)

   HINT 1          HINT 2   
Time Limit 1 second
Memory Limit 128 MB
Stats
上一题 下一题