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.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Dictionary;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Map;
import java.util.StringTokenizer;

import javax.print.attribute.DocAttributeSet;
import javax.print.attribute.HashDocAttributeSet;

import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskA solver = new TaskA();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskA {
	boolean[] is_prime;
	int max;
	public void sieve(){
		max = (1<<29)+(1<<27)+(1<<24)+(1<<23);
		//System.out.println(max);
		is_prime = new boolean[max+1];
		is_prime[0] = is_prime[1] = true;
		for(int i = 2; i*i < max; i++){
			if(!is_prime[i]){
				for(int j = i*i; j <= max; j+=i){
					is_prime[j] = true;
				}
			}
		}
	}	 
    
    public void solve(int testNumber, InputReader in, PrintWriter out) {
       int n = in.nextInt() ;
       int set = (int)( 5e6 + 10);
       int[] res = new int[set];
       Arrays.fill(res, 1);
       for(int i = 2; i*i < set; i++){
    	   if(res[i] == 1)
    		   for(int j = i*i; j < set; j+=i)
    			   res[j] = res[i] + res[j/i];
       }
       for(int i =2; i < set; i++)
    	   res[i] += res[i-1];
       for(int i = 0; i < n; i++)
    	   out.println(res[in.nextInt()] - res[in.nextInt()]);
    }
  }



    //||||||| UNION FIND ||||||||
  class uni_find{
	  int[] id , sz;
	  int count ;
	 
	  public uni_find(int N){
		  count = N;
	      id = new int[N];
	      sz = new int [N];
	      for (int i = 0; i < N; i++)
	         id[i] = i;
	      for (int i = 0; i < N; i++)
	    	  sz[i] = 1;
	  }
	  
	  private int find(int p) 
	  {  
	     while (p != id[p]) p = id[p];
	     return p; 
	  }
	  public void union(int p, int q)
	   {  
	      int i = find(p);
	      int j = find(q);
	      if (i == j) return;
	     // Make smaller root point to larger one.
	      if   (sz[i] < sz[j]) { id[i] = j; sz[j] += sz[i]; }
	      else                 { id[j] = i; sz[i] += sz[j]; }
	      count--;
	   }
	  
	  public int count() {
			return count;
		}
		public boolean connected(int p, int q) {
			return find(p) == find(q);
		}
  }
  
  
         //||||||| comparable pair ||||||||
 class pair implements Comparable<pair>{
	 public long first,second;
	 public pair(){
		 first = second = 0;
	 }
	@Override
	public int compareTo(pair arg0) {
		if(this.second > arg0.second)
			return 1;
		else if(this.second < arg0.second)
			return -1;
		else if(this.first > arg0.first)
			return 1;
		else if(this.first < arg0.first)
		     return -1;
		return 0;
	}
 }

 
   // ||||||| INPUT READER ||||||||
class InputReader {
    public BufferedReader reader;
    public StringTokenizer tokenizer;

    public InputReader(InputStream stream) {
        reader = new BufferedReader(new InputStreamReader(stream));
        tokenizer = null;
    }

    public String next() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public Integer nextInt() {
        return Integer.parseInt(next());
    }
    
    public Long nextLong() {
    	return Long.parseLong(next());
    }
    
    public Double nextDouble() {
    	return Double.parseDouble(next());
    }
    
    public Float nextFloat() {
    	return Float.parseFloat(next());
    }
    
    public BigInteger nextBigInteger() {
    	return new BigInteger(next());
    }
    
    public String nextLine() {
    	try {
			return reader.readLine();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		}
    	
    }
    
    public Integer[] nextIntegerArray(int n) {
    	Integer[] a = new Integer[n];
    	for(Integer i = 0; i <  n; i++)
    		a[i] = nextInt();
    	
    	return a;
    }
    
    public Long[] nextLongArray(int n) {
    	Long[] a = new Long[n];
    	for(Integer i = 0; i <  n; i++)
    		a[i] = nextLong();
    	
    	return a;
    }
    
    public long[] nextlongArray(int n) {
    	long[] a = new long[n];
    	for(Integer i = 0; i <  n; i++)
    		a[i] = nextLong();
    	
    	return a;
    }
    
    public double[] nextdoubleArray(int n) {
    	double[] a = new double[n];
    	for(Integer i = 0; i <  n; i++)
    		a[i] = nextDouble();
    	
    	return a;
    }
    
    public String[] nextStringArray(int n){
    	String[] s = new String[n];
    	for(Integer i = 0; i < n; i++)
    		s[i] = next();
    	return s;
    }
    
    public String[] nextLineStringArray(int n){
    	String[] s = new String[n];
    	for(Integer i = 0; i < n; i++)
    		s[i] = next();
    	return s;
    }

    
    }