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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;


public class CF_304_D {
    private static int[] sieveAndUsedInPfactors(int n){//O (n \log \log n)
        int[] primeFactors = new int[n+1];
        primeFactors[0] = primeFactors[1] = -1;
        int rootN = (int)Math.sqrt(n);
        for(int i=2 ; i <= rootN ; i++){
            if(primeFactors[i] == 0){
                for(int j = i*i ; j<=n ; j += i){
                    primeFactors[j] = i;
                }
            }
        }
        
        for(int i=2 ; i<=n ; i++){
            if(primeFactors[i] == 0)primeFactors[i] = i;
        }
        return primeFactors;
    }
    //---------------------------------------------------------------------------------
    private static int getPrimefactorsCount(int x,int[] primeFactors, int[] cum){
        int result = 0;
        while(primeFactors[x] != -1){
            result++;
            x /= primeFactors[x];
            if(cum[x] != -1){
                result += cum[x] - cum[x - 1];
                break;
            }
        }
        
        return result;
    }
    
    public static void main(String[] args) throws IOException{
        PrintWriter pw = new PrintWriter(System.out, true);
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        
        int n = 5000009, a, b;
        long ans;
        int[] p = sieveAndUsedInPfactors(n);
        int[] cum = new int[n];
        Arrays.fill(cum, -1);
        cum[0] = 0;
        cum[1] = 0;
        
        for(int i = 2 ; i < n ; i++){
            cum[i] = cum[i-1] + getPrimefactorsCount(i, p, cum);
        }
        
        int T = Integer.parseInt(input.readLine());
        String[] line;
        while(T-- != 0){
                line = input.readLine().split(" ");
                a = Integer.parseInt(line[0]);
                b = Integer.parseInt(line[1]);
                ans = cum[a] - cum[b];
                pw.print(ans+"\n");
        }
        
        
        
        pw.close();
        input.close();
    }
}