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

/**
 * Created with IntelliJ IDEA.
 * User: igarus
 * Date: 22.05.15
 * Time: 20:34
 * To change this template use File | Settings | File Templates.
 */
public class CodeForces304D {

    public static final int MAX = 5000001;
    public static int[] factorsCount = new int[MAX];
    public static int[] sumFactorsCount = new int[MAX];
    public static void main(String[] args) throws Exception {
        List<Integer> primes = generatePrime(2300);
        long time = System.currentTimeMillis();
        for (int i = 2; i < MAX; i++) {
            findFactorsCount(i, primes);
        }
        for (int i = 2; i < MAX; i++) {
            sumFactorsCount[i] = sumFactorsCount[i-1] + factorsCount[i];
        }
//        System.out.println("elapsed = " + (System.currentTimeMillis() - time));
//        Scanner scanner = new Scanner(System.in);
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(bufferedReader.readLine());
//        int t = scanner.nextInt();
//        scanner.nextLine();
//        int[] A = new int[t];
//        int[] B = new int[t];
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < t; i++) {
            String s[] = bufferedReader.readLine().split(" ");
            int a = Integer.parseInt(s[0]);
            int b = Integer.parseInt(s[1]);
            sb.append((sumFactorsCount[a] - sumFactorsCount[b])).append("\n");
        }
//        if (t < 1000)
            System.out.println(sb.toString());
    }

    public static void solve(int a, int b) {
        int s = 0;
        s = sumFactorsCount[a] - sumFactorsCount[b];
//        for (int i = b + 1; i <= a; i++) {
//            s += factorsCount[i];
//        }
        System.out.println(s);
    }

    public static int findFactorsCount(int n, List<Integer> primes) {
        int count = 0;
        int m = n;
        for (int prime : primes) {
            if (prime*prime > n)
                break;
            while (m%prime == 0) {
                count++;
                m /= prime;
                if (factorsCount[m] > 0) {
                    count += factorsCount[m];
                    factorsCount[n] = count;
                    return count;
                }
            }
        }
        if (m != 1)
            count++;
        factorsCount[n] = count;
        return count;
    }


    public static Integer[] findPrimeFactors(int n, List<Integer> primes) {
        ArrayList<Integer> factors = new ArrayList<>();
        int m = n;
        for (int prime : primes) {
            if (prime*prime > n)
                break;
            while (m%prime == 0) {
                factors.add(prime);
                m /= prime;
            }
        }
        if (m != 1)
            factors.add(m);
        return factors.toArray(new Integer[factors.size()]);
    }


    public static List<Integer> generatePrime(int n) {
        int d = 2*3*5;
        List<Integer> prime = new ArrayList<>();
        Integer[] base = {1, 7, 11, 13, 17 , 19, 23, 29};
        Integer[] init = {2, 3, 5, 7, 11 , 13, 17, 19, 23, 29};
        for (int i = 0; i < init.length && i < n; i++)
            prime.add(init[i]);
        for (int i = 1; i <= n/d; i++) {
            for (Integer k : base) {
                boolean addPrime = true;
                int add = k + d * i;
                if (add > n)
                    return prime;
                for (int j = 0; ; j++) {
                    int get = prime.get(j);
                    if (add % get == 0) {
                        addPrime = false;
                        break;
                    }
                    if (get * get >= add)
                        break;
                }
                if (addPrime)
                    prime.add(add);
            }
        }
        return prime;
    }

}