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.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Queue;
import java.util.StringTokenizer;
         
        public class Main
            {
                static BufferedReader   in  = new BufferedReader(new InputStreamReader(
                                                    System.in));
                static BufferedWriter   out = new BufferedWriter(
                                                    new OutputStreamWriter(System.out));
                final static int        MOD = 1000000007;
                static int[] powOfTwo = new int[31];
                static int limit =5000001;
                public static void main(String[] args) throws Exception
                    {
                    
//                  double start = System.currentTimeMillis();
                    
                    
                    
                    for(int i = 0;i<limit;i++)
                    {
                        primeDiv[i]=1;
                    }
                    for(int i =2;i<=limit/i;i++)
                    {
                        if(primeDiv[i]==1)
                        {
                            for(int j =i;j*i<limit;j++)
                            {
                                primeDiv[i*j] = primeDiv[i]+primeDiv[j];
                            }
                        }
                    }
                    
                    
                    primeDiv[0]=0;
                    primeDiv[1]=0;

//                  System.out.println(Arrays.toString(primeDiv));
                    
                    for(int i =1;i<limit;i++)
                    {
                        
                        primeDiv[i]+=primeDiv[i-1];
                    }
                    
//                  System.out.println(Arrays.toString(primeDiv));
//                  System.out.println((System.currentTimeMillis() - start));
//                  System.exit(0);
                    
                    
//                       long test = 1;
                        long test = strToLong(in.readLine()); // if number of test cases
                        for (int i = 0; i < test; i++)
                            {
                                req();
                            }
                        out.flush();
                        // System.out.println(System.currentTimeMillis()-start);
                        out.close();
         
                    }
                
                
                static int primeDiv[] = new int[limit]; 
                public static void req() throws Exception
                    {
                     
                    long input[] = splits(in.readLine(),2);
                    out.write((     primeDiv[(int)input[0]]-primeDiv[(int)input[1]]   )+"\n");
                            
                    
                    }
                    
                    
                    
                            
                static String hash(Queue<Integer> q1,Queue<Integer> q2)
                {
                    StringBuilder s = new StringBuilder();
                    for(Integer x :q1)
                    {
                        s.append(x+"");
                    }
                    
                    s.append("*");
                    
                    for(Integer x :q2)
                    {
                        s.append(x+"");
                    }
                    
                    return s.toString();
                    
                }
            
                static long[] splits(String s, int n)
                    {
         
                        long[] out = new long[n];
                        int idx = 0;
         
                        StringTokenizer ss = new StringTokenizer(s);
                        while (ss.hasMoreTokens())
                            {
                                out[idx] = strToLong(ss.nextToken());
         
                                idx++;
                            }
         
                        return out;
         
                    }
         
                static long gcd(long a, long b)
                    {
                        if (b == 0)
                            {
                                return a;
                            } else
                            return gcd(b, a % b);
                    }
         
                public static long max(long a, long b)
                    {
                        if (a > b)
                            return a;
                        return b;
                    }
         
                public static long modPro(long a, long b)
                    {
                        // check value of MOD , may vary for different questions
                        return ((a % MOD) * (b % MOD)) % MOD;
                    }
         
                public static long min(long a, long b)
                    {
                        if (a < b)
                            return a;
                        return b;
                    }
         
                public static int strToInt(String str)
                    {
                        int i = 0;
                        int num = 0;
                        boolean isNeg = false;
                        // Check for negative sign; if it's there, set the isNeg flag
                        if (str.charAt(0) == '-')
                            {
                                isNeg = true;
                                i = 1;
                            }
                        // Process each character of the string;
                        while (i < str.length())
                            {
                                num *= 10;
                                num += str.charAt(i++) - '0'; // Minus the ASCII code of
                                                                // '0' to get
                                // the value of the charAt(i++).
                            }
                        if (isNeg)
                            num = -num;
                        return num;
                    }
         
                public static long strToLong(String str)
                    {
                        int i = 0;
                        long num = 0;
                        boolean isNeg = false;
                        // Check for negative sign; if it's there, set the isNeg flag
                        if (str.charAt(0) == '-')
                            {
                                isNeg = true;
                                i = 1;
                            }
                        // Process each character of the string;
                        while (i < str.length())
                            {
                                num *= 10;
                                num += str.charAt(i++) - '0'; // Minus the ASCII code of
                                                                // '0' to get
                                // the value of the charAt(i++).
                            }
                        if (isNeg)
                            num = -num;
                        return num;
                    }
         
            }