| VIII MaratonUSP Freshman Contest |
|---|
| Finished |
Otávio, the archaeologist, was about to enter the archaeological site where he is currently conducting his research when he was stopped by the sphinx known as Matheusphinx.
In order to pass and continue his research, Otávio would need to answer the sphinx's riddle. This time, Matheusphinx asked a simple question: 'What percentage of statistics are false?'
The question caught Otávio off guard, and he immediately answered '75%', which was completely incorrect. Fortunately, sphinxes work retroactively, meaning that if for some reason this answer becomes correct, the sphinx will grant passage to Otávio.
Otávio has spent his entire life studying archaeology, so he knows the exact number of true statistics $$$v$$$ and the number of false statistics $$$f$$$.
Another thing Otávio learned in his research is that proclaiming the phrase 'More than 75% of the statistics are false' counts as a statistic and changes the number of true or false statistics according to $$$v$$$ or $$$f$$$. If $$$\frac{f}{v + f} \gt 75\%$$$ and this phrase is proclaimed, it is true, and therefore the value of $$$v$$$ increases by $$$1$$$. Otherwise, the value of $$$f$$$ would increase by $$$1$$$.
Otávio needs to get back to work and has asked for your help to write a program that, given the number of true statistics $$$v$$$ and the number of false statistics $$$f$$$, shows him how many times the phrase 'More than 75% of the statistics are false' needs to be used so that exactly 75% of the statistics will then be false.
The input contains multiple test cases.
The first line of the input contains a number $$$1 \leq t \leq 10^5$$$, the number of test cases.
Each of the next $$$t$$$ lines contains two numbers $$$v$$$ and $$$f$$$ ($$$0 \leq v, f \leq 10^8$$$), the number of true statistics and the number of false statistics, respectively. It is guaranteed that $$$v + f \gt 0$$$ and that $$$\frac{f}{v + f} \neq 0.75$$$.
The output should contain $$$t$$$ numbers, one for each test case. The $$$i$$$-th number should be the number of times Otávio needs to say "More than 75% of the statistics are false" so that exactly 75% of the statistics are false in the $$$i$$$-th test case.
5 1 0 1 2 1 5 1 6 0 1
3 1 2 1 3
| Name |
|---|


