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.OutputStreamWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.StringTokenizer;
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);
		OutputWriter out = new OutputWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        int primes[]= sieve_of_eratostenes.primefunction((int)(Math.sqrt(5000005)));
        long factors[]=new long[5000005];
        Arrays.fill(factors,-1);
        factors[0]=0;
        factors[1]=0;
        for(int i=2;i<=5000000;i++){
            long x=i,cou=0;
            for(int j=0;j<primes.length;j++){
                if(x%primes[j]==0){
                    cou=1+factors[(int)(x/primes[j])];
                    break;
                }
                if((primes[j]*primes[j])>x)
                    break;
            }
            if(cou==0)
                cou++;
            factors[i]=cou;
            //System.out.println(i+" "+factors[i]);
        }
        for(int i=1;i<5000000;i++){
            factors[i+1]+=factors[i];
        }
        int t=in.nextInt();
        while (t-->0){
            int a=in.nextInt(),b=in.nextInt();
            out.printLine(factors[a]-factors[b]);
        }
    }
}

class InputReader {
    BufferedReader in;
    StringTokenizer tokenizer=null;

    public InputReader(InputStream inputStream)
    {
        in=new BufferedReader(new InputStreamReader(inputStream));
    }
    public String next()
    {
        try{
            while (tokenizer==null||!tokenizer.hasMoreTokens())
            {
                tokenizer=new StringTokenizer(in.readLine());
            }
            return tokenizer.nextToken();
        }
        catch (IOException e)
        {
            return null;
        }
    }
    public int nextInt()
    {
        return Integer.parseInt(next());
    }
}

class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

    public void print(Object...objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void printLine(Object...objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }
}

class sieve_of_eratostenes {
    public static int[] primefunction(int n){
        int z=(int)(Math.ceil(((double)n)/2.0));
        int ar[]=new int [z-1],l=0,k,npc=0,c;
        for(int i=3;i<=n;i+=2){
            ar[l++]=i;}k=0;
        while(ar[k]*ar[k]<=n){
            c=k+ar[k];
            while(c<l){
                if(ar[c]!=0)
                    npc++;
                ar[c]=0;
                c=c+ar[k];
            }
            k++;
            while(ar[k]==0)
                k++;
        }
        int ar1[]=new int [z-npc];
        c=0;k=0;
        ar1[k++]=2;
        while(c<l){
            if(ar[c]!=0)
                ar1[k++]=ar[c];
            c++;
        }
        return ar1;
    }
}