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

public class D {
    final static int MOD = (int) 1e9 + 7;

    public static void main(String[] args) {
        int t = nextInt();
        int MAX = 5 * 1000 * 1000;
        int[] lowestPrimeFactors = getLowestPrimeFactors(MAX);
        int[] factors = new int[MAX + 1];
        long[] sum = new long[MAX + 1];
        for (int i = 2; i <= MAX; i++) {
            factors[i] = factors[i / lowestPrimeFactors[i]] + 1;
            sum[i] = sum[i - 1] + factors[i];
        }
        StringBuilder sb = new StringBuilder();
        while (t-- > 0) {
            int a = nextInt();
            int b = nextInt();
            sb.append(sum[a] - sum[b]);
            sb.append("\n");
        }
        System.out.print(sb);
    }

    static int[] getLowestPrimeFactors(int n) {
        int lim = n + 1;
        int[] lowestPrimeFactors = new int[lim];
        boolean[] flags = new boolean[lim];
        for (int i = 2; i < lim; i += 2) {
            lowestPrimeFactors[i] = 2;
        }
        for (int i = 3; i < lim; i += 2) {
            if (!flags[i]) {
                lowestPrimeFactors[i] = i;
                for (int j = i; (long) j * i < lim; j += 2) {
                    if (!flags[i * j]) {
                        flags[i * j] = true;
                        lowestPrimeFactors[i * j] = i;
                    }

                }
            }
        }
        return lowestPrimeFactors;
    }

    /*****************************************************************
     ******************** BASIC READER *******************************
     *****************************************************************/

    static InputStream is = System.in;
    static private byte[] inbuf = new byte[1024];
    static private int lenbuf = 0, ptrbuf = 0;

    static private int readByte() {
        if (lenbuf == -1)
            throw new InputMismatchException();
        if (ptrbuf >= lenbuf) {
            ptrbuf = 0;
            try {
                lenbuf = is.read(inbuf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (lenbuf <= 0)
                return -1;
        }
        return inbuf[ptrbuf++];
    }

    static private boolean isSpaceChar(int c) {
        return !(c >= 33 && c <= 126);
    }

    static private int skip() {
        int b;
        while ((b = readByte()) != -1 && isSpaceChar(b))
            ;
        return b;
    }

    static private double nextDouble() {
        return Double.parseDouble(nextString());
    }

    static private char nextChar() {
        return (char) skip();
    }

    static private String nextString() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!(isSpaceChar(b))) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    static private char[] nextString(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while (p < n && !(isSpaceChar(b))) {
            buf[p++] = (char) b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    static private int[][] nextMatrix(int n, int m) {
        int[][] map = new int[n][];
        for (int i = 0; i < n; i++)
            map[i] = nextAi(n);
        return map;
    }

    static private int[] nextAi(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    static private Integer[] nextAI(int n) {
        Integer[] a = new Integer[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    static private int nextInt() {
        int num = 0, b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
            ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    static private long nextLong() {
        long num = 0;
        int b;
        boolean minus = false;
        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
            ;
        if (b == '-') {
            minus = true;
            b = readByte();
        }

        while (true) {
            if (b >= '0' && b <= '9') {
                num = num * 10 + (b - '0');
            } else {
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    static class BIT {
        int[] SUM;
        int n;

        public BIT(int n) {
            SUM = new int[n + 1];
            this.n = n + 1;
        }

        public void setSum(int pos, int val) {
            for (int i = pos; i < n; i += (i & -i)) {
                SUM[i] += val;
            }
        }

        public int getSum(int to) {
            int sum = 0;
            for (int i = to; i > 0; i -= (i & -i)) {
                sum += SUM[i];
            }
            return sum;
        }

        public int getSum(int from, int to) {
            return getSum(to) - getSum(from);
        }
    }
}