Master Zhu and Video
시간 제한1초메모리 제한512 MB
볼륨을 p에서 q로 옮기는 최소 시간을 구한다. 연속으로 내리기 명령을 쓰면 감소량이 두 배가 된다.
문제
Master Zhu is watching a video. He wants to adjust the sound volume from dB to 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 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 dB, it decreases by dB, otherwise the volume decreases by 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 dB to dB.
입력
The first line of input contains one integer , the number of test cases ().
Each of the next lines contains two integers and ().
출력
For each test case, print a single line with a single integer: the minimum time in seconds Master Zhu needs to adjust the volume.