시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB32266.667%

문제

Master Zhu is watching a video. He wants to adjust the sound volume from $p$ dB to $q$ dB. Master Zhu is powerful enough to control the sound volume mentally. He needs one second to issue one order. So, each second, he may either issue an order "Up!", issue an order "Down!", or do nothing.

If he issues an order "Up!", the volume increases by $1$ dB. An order "Down!" works in a more compilcated way: if on the previous second, there was an order "Down!" and the volume decreased by $x$ dB, it decreases by $2 \cdot x$ dB, otherwise the volume decreases by $1$ dB.

If after some order the volume becomes negative, the system will break, so Master Zhu must be careful.

Find the minimum time needed for Master Zhu to adjust the volume from $p$ dB to $q$ dB.

입력

The first line of input contains one integer $T$, the number of test cases ($1 \le T \le 3 \cdot 10^5$).

Each of the next $T$ lines contains two integers $p$ and $q$ ($0 \le p, q \le 10^9$).

출력

For each test case, print a single line with a single integer: the minimum time in seconds Master Zhu needs to adjust the volume.

예제 입력 1

2
1 5
7 3

예제 출력 1

4
4