Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
E. Josuke and Complete Graph

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputJosuke received a huge undirected weighted complete$$$^\dagger$$$ graph $$$G$$$ as a gift from his grandfather. The graph contains $$$10^{18}$$$ vertices. The peculiarity of the gift is that the weight of the edge between the different vertices $$$u$$$ and $$$v$$$ is equal to $$$\gcd(u, v)^\ddagger$$$. Josuke decided to experiment and make a new graph $$$G'$$$. To do this, he chooses two integers $$$l \le r$$$ and deletes all vertices except such vertices $$$v$$$ that $$$l \le v \le r$$$, and also deletes all the edges except between the remaining vertices.

Now Josuke is wondering how many different weights are there in $$$G'$$$. Since their count turned out to be huge, he asks for your help.

$$$^\dagger$$$ A complete graph is a simple undirected graph in which every pair of distinct vertices is adjacent.

$$$^\ddagger$$$ $$$\gcd(x, y)$$$ denotes the greatest common divisor (GCD) of the numbers $$$x$$$ and $$$y$$$.

Input

The first line contains one integer $$$t$$$ ($$$1 \le t \le 100$$$) — the number of test cases.

The first line of each test case contains two numbers $$$l$$$, $$$r$$$ ($$$1 \le l \le r \le 10^{18}$$$, $$$l \le 10^9$$$).

Output

For each test case print a single number — the number of different weights among the remaining edges.

Example

Input

72 416 242 61 103 32562 2568125 100090

Output

2 6 3 5 0 5 50045

Note

The picture above shows that the graph has $$$2$$$ different weights.

In the fifth test case, there is only one vertex from which no edges originate, so the answer is $$$0$$$.

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Feb/08/2023 19:37:08 (i2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|