P13787 [CodeChef] ccaurcc5
NOI
题目描述

An integer is said to be prime palindrome if it is a prime number and its reverse is same as that of the original number.
Your task is to output the sum of all such prime palindromes lies between the range N and M (N and M both are inclusive).

Input description.

The first line of input contains an integer Tdenoting the number of test cases.
The Second line contains two integers N and M denoting the range.

Output Description:

Output is the sum of all prime palindromes lies between N and M.

Constraints

1 ≤ T ≤ 100
1 ≤ N ≤ M≤10^8

Example
Input:
1
1 101

Output:
129

Explanation
TestCase 1]: The prime palindromes lies between the range 1 to 101 are 2,3,5,7,11 and 101.The sum of all these numbers is 129 which is the
output.

输入格式

见题面

输出格式

见题面

样例输入
1 1 101
样例输出
129