P21559 [HackerEarth] Bob has just learned number theory and is very excited about it. Unlike everytime, Bob is not in trouble this time, but being kind hearted he now goes to his friend Peter who is stuck at
普及
题目描述

Bob has just learned number theory and is very excited about it. Unlike everytime, Bob is not in trouble this time, but being kind hearted he now goes to his friend Peter who is stuck at a problem of Number theory, to help him. Now, Peter describes the problem to Bob as, given two numbers a and b(both inclusive), find the number of prime pairs between a and b whose XOR is an odd number. Bob thinks for a while and then looks at the constraints of a and b. As he finds that the constraints are large enough that can't be handled manually, he asks your help to write a program for the same.

Input:

The first line consists of the number of test cases t. t lines follow then.
Each of the t lines, consists of 2 positive integers a and b, separated by a space.

Output:

For each test case, output the desired result on a separate line.

Constraints:

1 ≤ t ≤ 10

1 ≤ a, b ≤ 10^9

0 ≤ b-a ≤ 10^6

SAMPLE INPUT
1
2 4

SAMPLE OUTPUT
1

Explanation

Between 2 and 4, numbers that are prime are 2, 3. The prime number pair whose XOR is odd is: (2, 3)

输入格式

见题面

输出格式

见题面

样例输入
10 1 1 1 2 2 2 2 3 3 3 1 11 2 20 999000000 1000000000 1 1000001 2 1000002
样例输出
55564 22287 74761 48912 46397 14926 46013 36278 42737 62635