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.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class a {
	public static class node {
		int node;
		int val;
		int idx;

		node(int index, int val, int r) {
			node = index;
			this.val = val;
			idx = r;
		}

	}

	public static class point implements Comparable<point> {
		int x;
		long val;

		point(int x, long val) {
			this.x = x;
			this.val = val;
		}

		public int compareTo(point o) {
			if (o.val < val)
				return 1;
			else if (o.val > val)
				return -1;

			return 0;
		}

	}

	public static long gcd(long a, long b) {
		if (b == 0)
			return a;
		return gcd(b, a % b);
	}

	public static ArrayList<Integer> prime;
	public static int factor[];
	public static long dp[];

	public static void sieve(int n) {
		boolean vis[] = new boolean[n + 5];
		vis[1] = true;
		vis[0] = true;
		for (int i = 2; i <= n; i++) {
			if (!vis[i]) {
				// prime.add(i);
				for (int j = i; j <= n; j += i) {
					vis[j] = true;
					int k = j;
					while (k % i == 0) {
						factor[j]++;
						k /= i;
					}
				}
			}
		}

		for (int i = 1; i <= n; i++) {
			dp[i] = dp[i - 1] + (long) factor[i];
		}
	}

	public static int tree[][];
	public static boolean end[][];
	public static int counter;

	public static void trie(String a) {
		int st = 0;

		for (int i = 0; i < a.length(); i++) {
			if (tree[a.charAt(i) - 'a'][st] == 0) {
				tree[a.charAt(i) - 'a'][st] = counter++;
			}

			st = tree[a.charAt(i) - 'a'][st];
		}
		end[a.charAt(a.length() - 1) - 'a'][st] = true;

	}

	public static int seg[][];
	public static int a[][];
	public static int m;

	public static void build(int s, int e, int p) {
		if (s == e) {
			for (int i = 0; i < m; i++) {
				// System.out.println(p+" "+s);
				seg[i][p] = a[i][s];
			}
			return;
		}
		int mid = (s + e) / 2;
		build(s, mid, p * 2);
		build(mid + 1, e, p * 2 + 1);
		for (int i = 0; i < m; i++) {
			seg[i][p] = Math.max(seg[i][p * 2], seg[i][p * 2 + 1]);
		}
	}

	public static int get(int s, int e, int p, int from, int to, int seg[]) {
		if (s >= from && e <= to)
			return seg[p];
		if (s > to || e < from)
			return 0;
		int mid = (s + e) / 2;
		int one = get(s, mid, p * 2, from, to, seg);
		int two = get(mid + 1, e, p * 2 + 1, from, to, seg);
		return Math.max(one, two);
	}

	public static long solve(Queue<Integer> q1, Queue<Integer> q2) {

		long ans = 0;
		int size1 = q1.size();
		int size2 = q2.size();
		String a = "";
		for (int i = 0; i < size1; i++) {
			int e = q1.poll();
			a += e;
			q1.add(e);
		}
		for (int i = 0; i < size2; i++) {
			int e = q2.poll();
			// System.out.println(e);
			ans = ans * 10L + (long) e;
			a += e;
			q2.add(e);
		}
		ans = Long.parseLong(a);
		return ans;
	}

	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		// BufferedReader in = new BufferedReader(new FileReader(
		// "B-small-attempt0.in"));

		StringBuilder q = new StringBuilder();
		PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
		// PrintWriter out = new PrintWriter(new FileWriter("out.txt"));
		factor = new int[5000000 + 5];
		dp = new long[5000000 + 5];
		sieve(5000000);

		int n = Integer.parseInt(in.readLine());
		for (int i = 0; i < n; i++) {
			String y[] = in.readLine().split(" ");
			int one = Integer.parseInt(y[0]);
			int two = Integer.parseInt(y[1]);
			long ans=dp[one]-dp[two];
			q.append(ans+"\n");
		}
		System.out.println(q);

		out.close();
	}
}