This problem is a programming version of Problem 37 from projecteuler.net
The number has an interesting property. Being prime itself, it is possible to continuously remove digits from left to right, and remain prime at each stage: , , , and . Similarly we can work from right to left: , , , and .
Find the sum of primes that are both truncatable from left to right and right to left below .
NOTE: , , , and are not considered to be truncatable primes.
Input Format
Input contains an integer .
Constraints
Output Format
Print the answer corresponding to the test case.
Sample Input
100
Sample Output
186