cho.sh
Notes
Loading...

Hello, 2048!

Time limit

1s

Memory limit

512 MB

Problem

Sungbin, who studies computer science, is especially fond of powers of two. One day, while looking at a calendar, he realized that the year 2048 was approaching. He wondered how likely it was for an arbitrary person to live through a year that is a power of two, and thought that this probability would decrease as time passed.

While staring at the number 2048, Sungbin noticed something interesting: it contains the digits 2, 4, and 8, which are themselves powers of two. This led him to the following question.

Let NNN be the decimal number formed by writing 2l,2l+1,⋯ ,2r2^l, 2^{l+1}, \cdots, 2^r2l,2l+1,⋯,2r in decimal notation and concatenating them in that order. How many times can NNN be divided by 2 consecutively?

The number can become far too large to build directly. Write a program that answers Sungbin's question.

Input

The first line contains an integer TTT, the number of test cases.

Each test case consists of two integers lll and rrr separated by a space.

Output

For each test case, print one line containing the answer to Sungbin's question.

Constraints

  • 1≤T≤1051 \leq T \leq 10^51≤T≤105
  • 0≤l≤r≤1090 \le l \le r \le 10^90≤l≤r≤109