시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 2048 MB111100.000%

문제

This is an interactive problem.

Let $x$ be an even-dominant number if the total number of even decimal digits of $x$ and $\left\lfloor \sqrt{x} \right\rfloor$ (the decimal representation of the square root of $x$, rounded down to the nearest integer) is greater than the total number of odd decimal digits of these numbers.

For example, $222\,213$ is an even-dominant number because the total number of even digits in $222\,213$ and $\left\lfloor \sqrt{222\,213} \right\rfloor = 471$ is $5$, which is greater than $4$, the total number of odd digits. However, the number $2$ is not an even-dominant number because the total number of even digits in $2$ and $\left \lfloor \sqrt{2} \right \rfloor = 1$ is equal to the total number of odd digits.

Determine the number of even-dominant numbers in the segment $[\ell, r]$.

인터랙션 프로토콜

The jury's program outputs a sequence of queries, one after the other. Once the participant's program has printed an answer for a given query, the jury's program will proceed to output the next query.

입력

The first line contains one integer $t$ ($1 \leq t \leq 10\, 000$): the number of queries.

Each of the next $t$ lines contains two integers $\ell_i$ and $r_i$ ($1 \leq \ell_i \leq r_i \leq 10^{12}$) denoting the segment for the $i$-th query.

출력

For each query, print a line with a single integer: the number of even-dominant numbers in the given segment.

예제 입력 1

1
1 10

예제 출력 1

3

채점 및 기타 정보

  • 예제는 채점하지 않는다.