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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 9;
long long QPow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
int vis[5000002];
int prim[5000002];
int top;
void init() {
  vis[0] = vis[1] = 1;
  int temp = 1;
  for (int i = 2; i <= 5000000; i++) {
    if (!vis[i]) {
      for (int j = 2; j * i <= 5000000; j++) {
        vis[j * i]++;
        temp = j;
        while (temp % i == 0) vis[j * i]++, temp /= i;
      }
      vis[i]++;
    }
  }
}
long long toInt(string str) {
  long long ans = 0;
  for (int i = 0; i < str.size(); i++) {
    ans *= 10;
    ans += str[i] - '0';
  }
  return ans;
}
string toString(long long a) {
  if (a == 0) return "0";
  string temp = "";
  long long tp = a;
  while (tp) {
    temp.push_back('0' + tp % 10);
    tp /= 10;
  }
  string temp2 = temp;
  for (int ii = 0; ii < temp.size(); ii++) {
    temp[ii] = temp2[temp.size() - 1 - ii];
  }
  return temp;
}
const int MAXN = 1;
const int INF = 0x3f3f3f3f;
const double eps = 1e-8;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int b[4][4];
int ans[4][4];
int md[4][4];
inline long long add(const long long &a, const long long &b) {
  return (a + b) >= mod ? (a + b) - mod : (a + b < 0 ? (a + b) + mod : a + b);
}
inline long long mul(const long long &a, const long long &b) {
  return 1LL * a * b % mod;
}
void matrixPow(int n) {
  while (n) {
    if (n & 1) {
      for (int i = 0; i < 4; i++)
        for (int j = 0; j < 4; j++) {
          md[i][j] = 0;
          for (int k = 0; k < 4; k++)
            md[i][j] = add(md[i][j], mul(ans[i][k], b[k][j]));
        }
      memcpy(ans, md, sizeof ans);
    }
    for (int i = 0; i < 4; i++)
      for (int j = 0; j < 4; j++) {
        md[i][j] = 0;
        for (int k = 0; k < 4; k++)
          md[i][j] = add(md[i][j], mul(b[i][k], b[k][j]));
      }
    memcpy(b, md, sizeof b);
    n >>= 1;
  }
}
inline void read(int &n) {
  char c = '+';
  bool flag = 0;
  n = 0;
  while (c < '0' || c > '9') {
    c = getchar();
    if (c == '-') flag = 1;
  }
  while (c >= '0' && c <= '9') n = n * 10 + c - 48, c = getchar();
}
signed main() {
  ifstream in("Text.txt");
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  long long n;
  int m;
  init();
  for (int i = 1; i <= 5000000; i++) vis[i] += vis[i - 1];
  scanf("%d", &t);
  int b, a;
  while (t--) {
    scanf("%d%d", &a, &b);
    printf("%d\n", vis[a] - vis[b]);
  }
  return 0;
}