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.awt.Point;
import java.awt.Rectangle;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.ObjectInputStream.GetField;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.security.KeyStore.Entry;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class Main {
    static FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(System.out);
    static boolean file = false;
    static final int maxn = (int)5e6+111;
    static long inf = (long)1e18;
    static int n;
    static boolean a[] = new boolean [maxn];
    static int d[] = new int [maxn];
    static int s[] = new int [maxn];
    static long sum[] = new long [maxn];
    
    private static void solve() throws Exception {
        Arrays.fill(a, true);

        for (int i=1; i<=5000000; i++) {
            d[i] = i;
        }
        
        resheto();
        
        for (int i=1; i<=5000000; i++) {
            int t = i;
            int cnt = 0;
            while (t!=1) {
                cnt++;
                t/=d[t];
            }
            s[i] = cnt;
            sum[i] = sum[i-1]+s[i];
        }
        
        int time = in.nextInt();
        for (int i=1; i<=time; i++) {
            int a = in.nextInt();
            int b = in.nextInt();
            out.println(sum[a]-sum[b]);
        }
        
    }  
        
    private static void resheto() {
        for (int i=2; i<=Math.sqrt(5000000); i++) {
            if (a[i]) {
                for (int j=i*i; j<=5000000; j+=i) {
                    a[j] = false;
                    d[j] = Math.min(d[j], i);
                }
            }
        }
    }

    public static void main (String [] args) throws Exception {
        
        if (file) {
            in = new FastReader(new BufferedReader(new FileReader("input.txt")));
            out = new PrintWriter ("output.txt");
        }
       
        solve();
        out.close();
    }

}


class Pair implements Comparable<Pair> {
    long x,y;
    Point q;
    public Pair(long x, long y) {
        this.x = x;
        this.y = y;
    }
    @Override
    public boolean equals(Object obj) {
        Pair p = (Pair)obj;
        if (p.x == x && p.y==y) return true;
        return false;
    }

    @Override
    public int compareTo(Pair p) {
        if (x<p.x)return 1;
        else if (x==p.x) return 0;
        else return -1;
    }
    
    
    
    
    
}

class FastReader {
    BufferedReader bf;
    StringTokenizer tk = null;

    public FastReader(BufferedReader bf) {
        this.bf = bf;
    }
    
    public String nextToken () throws Exception {
        if (tk==null || !tk.hasMoreTokens()) {
            tk = new StringTokenizer(bf.readLine());
        }
        return tk.nextToken();
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}