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.awt.Point;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.*;
import java.util.*;

public class Main {
	//////
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	//////
	public static long modularExponentiation(long x, long n, long M) {
		long result = 1;
		while (n > 0) {
			if (n % 2 == 1)
				result = (result * x) % M;
			x = (x * x) % M;
			n = n / 2;
		}
		return result;
	}

	public static long modularExponentiation1(long x, long n) {
		long result = 1;
		while (n > 0) {
			if (n % 2 == 1)
				result = (result * x);
			x = (x * x);
			n = n / 2;
		}
		return result;
	}

	/////

	static public int fun(int num) {
		int prod = 1;
		while (num > 0) {
			if (num % 10 != 0) {
				prod = prod * (num % 10);
			}
			num = num / 10;
		}
		return prod;
	}

	public static boolean dfs(int x, int find, boolean[] visited, int[][] matrix) {

		boolean ans = false;
		if (x == find) {
			ans = true;
			return true;
		}
		for (int i = 0; i < 26; i++) {
			if (visited[i] == false && matrix[x][i] == 1) {
				visited[i] = true;
				ans = ans || dfs(i, find, visited, matrix);
			}
		}

		return ans;
	}

	static int lis(int arr[], int n, int k, int b) {
		int lis[] = new int[n];
		int i, j, max = 0;

		/* Initialize LIS values for all indexes */
		for (i = 0; i < n; i++)
			lis[i] = 1;

		/* Compute optimized LIS values in bottom up manner */
		for (i = 1; i < n; i++)
			for (j = 0; j < i; j++)
				if (arr[i] >= k * arr[j] + b && lis[i] < lis[j] + 1)
					lis[i] = lis[j] + 1;

		/* Pick maximum of all LIS values */
		for (i = 0; i < n; i++)
			if (max < lis[i])
				max = lis[i];

		return max;
	}
	
	

	public static void main(String[] args) throws IOException {

		FastReader scan = new FastReader();
		PrintWriter pw = new PrintWriter(System.out);
		
		
		int[] SPF=new int[5000005];

		int[] primefactor=new int[5000005];
		for(int i=2;i*i<5000005;i++){
			if(SPF[i]==0){
				for(int j=i;j<5000005;j+=i){
					if(SPF[j]==0){
					SPF[j]=i;
					}
				}
			}
		}
		
		for(int i=2;i<5000005;i++){
			if(SPF[i]==0){
				SPF[i]=i;
				}
			primefactor[i]=primefactor[i/SPF[i]]+1;
		}
		
		int[] ans=new int[5000005];
		for(int i=2;i<5000005;i++){
			ans[i]=ans[i-1]+primefactor[i];
		}
		
		int T=scan.nextInt();
		
		while(T-->0){
			int a=scan.nextInt();
			int b=scan.nextInt();
			pw.println(ans[a]-ans[b]);
		}
		
		pw.close();
		
	}
}