Problem: Two soldiers are playing a game. At the beginning first of them chooses a positive integer n and gives it to the second soldier. Then the second one tries to make maximum possible number of rounds. Each round consists of choosing a positive integer x > 1, such that n is divisible by x and replacing n with n / x. When n becomes equal to 1 and there is no more possible valid moves the game is over and the score of the second soldier is equal to the number of rounds he performed.

To make the game more interesting, first soldier chooses n of form a! / b! for some positive integer a and b (a ≥ b). Here by k! we denote the factorial of k that is defined as a product of all positive integers not large than k.

What is the maximum possible score of the second soldier?

Input

First line of input consists of single integer t (1 ≤ t ≤ 1 000 000) denoting number of games soldiers play.

Then follow t lines, each contains pair of integers a and b (1 ≤ b ≤ a ≤ 5 000 000) defining the value of n for a game.

Output

For each game output a maximum score that the second soldier can get.

Examples

Input

2
3 1
6 3


Output

2
5

Solution (in JAVA):

Solution:
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Scanner;

public class Task_Rnd304_D {
	
	static int NN = 5000002;
	static int DD = 2236;
	static int pp[] = new int[400000];
	
	static int aa[] = new int[NN];
	

	public static void main(String[] args) throws NumberFormatException, IOException {
		
		Scanner in = new Scanner(System.in);
		
		pp[0] = 2;
		pp[1] = 3;
		int kk = 2;
		//for (int i = 5; i < NN; i += 2)
		for (int i = 5; i < 2236; i += 2)
		{
			int YY = (int)Math.sqrt(i);
			
			int j = 1;
			while (j < kk)
			{
				if (pp[j] > YY)
				{
					j = kk;
					break;
				}
				if (i % pp[j] == 0)
					break;
				j++;
			}
			
			if (j == kk)
			{
				pp[kk] = i;
				kk++;
			}
		}
		//System.out.println("gg2");
		
		for (int i = 0; i < NN; i++)
		{
			aa[i] = 0;
		}
		
		aa[1] = 1;
		for (int i = 0; i < kk; i++)
		{
			aa[pp[i]] = 1;
		}

		
		//*
		for (int i = 4; i < NN; i++)
		{
			if (aa[i] == 0)
			{
				if (i % 2 == 0)
				{
					aa[i] = aa[i / 2] + 1;
					continue;
				}
				if (i % 3 == 0)
				{
					aa[i] = aa[i / 3] + 1;
					continue;
				}
				if (i % 5 == 0)
				{
					aa[i] = aa[i / 5] + 1;
					continue;
				}
				if (i % 7 == 0)
				{
					aa[i] = aa[i / 7] + 1;
					continue;
				}
				if (i % 11 == 0)
				{
					aa[i] = aa[i / 11] + 1;
					continue;
				}
				if (i % 13 == 0)
				{
					aa[i] = aa[i / 13] + 1;
					continue;
				}
				if (i % 17 == 0)
				{
					aa[i] = aa[i / 17] + 1;
					continue;
				}
				if (i % 19 == 0)
				{
					aa[i] = aa[i / 19] + 1;
					continue;
				}
				if (i % 23 == 0)
				{
					aa[i] = aa[i / 23] + 1;
					continue;
				}
				
				int YY = (int)Math.sqrt(i);
				for (int jj = 0; jj < kk; jj++)
				{
					int HH = pp[jj];
					if (i % HH == 0)
					{
						aa[i] = aa[i / HH] + 1; 
					}
					if (HH > YY)
						break;
				}
			}
			if (aa[i] == 0)
			{
				aa[i] = 1;
			}
		}
		//*/
		
		//int max = 0;
		for (int i = 2; i < NN; i++)
		{
			aa[i] += aa[i-1];
			//if (aa[i] > max)
			//	max = aa[i];
		}
		
		
		//System.out.println("gg");
		/*
        int t = in.nextInt();
		for(int i = 0; i < t; i++)
		{
			int a = in.nextInt();
			int b = in.nextInt();
			
	        System.out.println(aa[a] - aa[b]);
		}
		*/
        
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintStream out = new PrintStream(new BufferedOutputStream(System.out));
		int cases = Integer.valueOf(br.readLine());
		for(int ctr=0; ctr<cases; ctr++) {
			String[] ss = br.readLine().trim().split("\\s+");
			int a = Integer.valueOf(ss[0]);
			int b = Integer.valueOf(ss[1]);
			out.println(aa[a] - aa[b]);
		}
		out.flush();        
	}
}