CF1981A.Turtle and Piggy Are Playing a Game

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Turtle and Piggy Are Playing a Game

Turtle and Piggy are playing a number game.

First, Turtle will choose an integer xx, such that lxrl \le x \le r, where l,rl, r are given. It's also guaranteed that 2lr2l \le r.

Then, Piggy will keep doing the following operation until xx becomes 11:

  • Choose an integer pp such that p2p \ge 2 and pxp \mid x (i.e. xx is a multiple of pp).
  • Set xx to xp\frac{x}{p}, and the score will increase by 11.

The score is initially 00. Both Turtle and Piggy want to maximize the score. Please help them to calculate the maximum score.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1041 \le t \le 10^4). The description of the test cases follows.

The first line of each test case contains two integers l,rl, r (1lr109,2lr1 \le l \le r \le 10^9, 2l \le r) — The range where Turtle can choose the integer from.

Output

For each test case, output a single integer — the maximum score.

Note

In the first test case, Turtle can choose an integer xx, such that 2x42 \le x \le 4. He can choose x=4x = 4. Then Piggy can choose p=2p = 2 for 22 times. After that, xx will become 11, and the score will be 22, which is maximized.

In the second test case, Turtle can choose an integer 3x63 \le x \le 6. He can choose x=6x = 6. Then Piggy can choose p=2p = 2, then choose p=3p = 3. After that, xx will become 11, and the score will be 22, which is maximum.

In the third test case, Turtle can choose x=12x = 12.

In the fourth test case, Turtle can choose x=16x = 16.

Samples

5
2 4
3 6
2 15
6 22
114514 1919810
2
2
3
4
20

在线编程 IDE

建议全屏模式获得最佳体验