Another New Function#10721

Another New Function

1 second
128 megabytes
Medium

The totient function or , also called Euler's totient function, is defined as the number of positive integers that are relatively prime to (i.e., do not contain any factor in common with) , where is counted as being relatively prime to all numbers. Since a number less than or equal to and relatively prime to a given number is called a totative the totient function can be simply defined as the number of totatives of . For example, there are eight totatives of (, , , , , , and ), so \varphi(24) = 8.

The depth of value of a number is denoted by the number of steps required before it reaches . An example will make it very clear.

So the depth of is . We name this function as . So we can write depthphi(13) = 4. The sum of function () takes two integers as parameter and its definition is given below:

prb10721.gif

Given the value of and your job is to find the value of SODF(m, n).

Input

The first line contains an integer (0 < n < 2001) which indicates how many tests are there. Each of the next lines contains two integers and (2 \le m \le n \le 2000000).

Output

For each test case produce one line that contains an integer, which actually denotes the value of SODF(m, n).

Examples

Example 1

Loading
Loading