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.util.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;



public class Main{
	
	// ArrayList<Integer> lis = new ArrayList<Integer>();
	// ArrayList<String> lis = new ArrayList<String>();
	// PriorityQueue<P> que = new PriorityQueue<P>();
	// PriorityQueue<Integer> que = new PriorityQueue<Integer>();
	//  Stack<Integer> stack = new Stack<Integer>();
	//HashMap<Long,Long> map = new HashMap<Long,Long>();
    //	static long sum=0;
	// 1000000007 (10^9+7)
	//static int mod = 1000000007;
	static long mod = 1000000007;
	//static int mod = 1000000009; ArrayList<Integer> l[]= new ArrayList[n];
    // static int dx[]={1,-1,0,0};
	// static int dy[]={0,0,1,-1};
	// //static int dx[]={1,-1,0,0,1,1,-1,-1};
    //static int dy[]={0,0,1,-1,1,-1,1,-1};
	
	//static Set<Integer> set = new HashSet<Integer>();
	//static ArrayList<Integer> l[];
    //static int parent[][],depth[],node,max_log;
	//static ArrayList<Integer> l[];

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

	//Scanner sc =new Scanner(System.in);
	
	Reader sc = new Reader(System.in);
 	
 	int n=sc.nextInt();//,k=sc.nextInt();

 	int mx=1000000*5, sf []=new int [mx+1];
    int d[]=new int[mx+1];
    int fc[]=new int[mx+1];


    for( int i=2; i<=mx; i++ ){
    	if (sf[i]==0){
    	sf[i]=i;
    	if((long)i*i<mx)
    	for(int t=i*i; t<=mx; t+=i ){
    		if(sf[t]>0)continue;
    		sf[t]=i;
    	}
	}

		int pr=i/sf[i];
    	d[i]=d[i-1]+fc[pr]+1;
    	fc[i]=fc[pr]+1;

    }

   StringBuilder sb=new StringBuilder("");

    for( int i=0; i<n; i++ ){
         sb.append(d[sc.nextInt()]-d[sc.nextInt()]+"\n");
    }

  System.out.println(sb);

}




/*
  static class P implements Comparable<P>{
	int id, d; ;
	P(int id,int d){
		this.id=id;
		this.d=d;
	} 
	
	public int compareTo(P x){
	//	return  (-x.d+d)>=0?1:-1  ; // ascend long
	//	return   -x.d+d  ; // ascend
		 return   x.d-d  ; //descend
	   }
 
}//*/



static void db(Object... os){
    System.err.println(Arrays.deepToString(os));

}

static boolean validpos(int x,int y,int r, int c){
	
	return x<r && 0<=x && y<c && 0<=y;
	
}

static boolean bit(long x,int k){
	// weather k-th bit (from right) be one or zero
	return  ( 0 < ( (x>>k) & 1 )  )  ? true:false;
}


}



	

class Reader
{ 
	private BufferedReader x;
	private StringTokenizer st;
	
	public Reader(InputStream in)
	{
		x = new BufferedReader(new InputStreamReader(in));
		st = null;
	}
	public String nextString() throws IOException
	{
		while( st==null || !st.hasMoreTokens() )
			st = new StringTokenizer(x.readLine());
		return st.nextToken();
	}
	public int nextInt() throws IOException
	{
		return Integer.parseInt(nextString());
	}
	public long nextLong() throws IOException
	{
		return Long.parseLong(nextString());
	}
	public double nextDouble() throws IOException
	{
		return Double.parseDouble(nextString());
	}
}