Time limit
1s
Memory limit
256 MB
151 is a prime palindrome because it is prime and reads the same from left to right and from right to left. A palindrome is a number whose digits are unchanged when read in reverse. The number 1234 becomes 4321 when read backward, so it is not a palindrome.
Given two integers a and b, find every prime palindrome from a through b, inclusive.
The first line contains two natural numbers a and b separated by a space.
The limits are 5 ≤ a < b ≤ 100,000,000.
Print the prime palindromes from a through b in increasing order, one per line.
After printing all such numbers, print -1 on the final line.