You have probably heard the legend of Sisyphus — as punishment for various offenses against the gods, he is forced to push a heavy stone up a mountain.
But when the stone reaches the top — it immediately rolls back down, and Sisyphus is forced to start all over again.
This has been going on for more than one century already — and Hades (the ruler of the underworld) decided to somehow make this action more interesting.
Now Sisyphus is forced to drag the stone along an infinite straight line.
During the day, Sisyphus can drag the stone by at most $$$A$$$ meters to the right (in the positive direction).
But at night, a strong wind starts blowing, which blows Sisyphus together with the stone to the left (in the negative direction).
To make things more interesting, the wind gets stronger every night — on the $$$i$$$-th night, the wind will blow Sisyphus $$$i \cdot B$$$ meters to the left.
Hades is interested in watching Sisyphus as long as he makes at least some progress to the right. Otherwise, Hades changes the parameters $$$A$$$ and $$$B$$$ and starts Sisyphus's punishment from the beginning.
For each pair $$$A$$$ and $$$B$$$, determine the maximum distance to the right Sisyphus can advance.
The first line contains an integer $$$Q$$$ $$$(1 \le Q \le 10^4)$$$ — the number of different punishment variants.
Each of the next $$$Q$$$ lines contains two integers $$$A_i$$$ and $$$B_i$$$ $$$(1 \le A_i, B_i \le 10^9)$$$ separated by a space — the distance Sisyphus can drag the stone to the right in one day, and the initial wind strength for the $$$i$$$-th punishment variant.
Print $$$Q$$$ lines.
In the $$$i$$$-th line, print one integer $$$D_i$$$ — the maximum positive distance Sisyphus can advance in the $$$i$$$-th punishment.
510 33 1042 4212345 876987654321 1
22 3 42 93195 487730529388812681
The first punishment.
Let us consider Sisyphus's coordinate on the line after each day and night:
It can be seen that Sisyphus advanced maximally to $$$22$$$ — after that, the wind will keep pushing him further and further to the left.
The second punishment.
Hades realized that he had overcomplicated things — and ended this trial.
The third punishment.
It was pointless to continue any further.
The fourth punishment.
This example is intended for additional verification of the correctness of your calculations.
The fifth punishment.
This example is intended for additional verification of the efficiency of your calculations.