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.
def prime (a):
    b=1
    p=0
    while b<a:
        f=a%b
        if f==0:
            p+=1
        b+=1
    if p<2:
        return True
n=input()
for i in range(n):
    a=map(int,raw_input().split())
    c=0
    for j in range(a[0],a[-1]+1):
        d=str(j)
        if j!=1 and d==d[::-1] and prime(j)==True:
            c+=j
    print c