F. Fair Distribution
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

There are $$$n$$$ robots and $$$m$$$ energy bars in the Dream Kingdom. DreamGrid, the king, is trying to make a fair distribution of the energy bars. A fair distribution exists if and only if the number of the energy bars is a multiple of the number of robots.

The only tool DreamGrid has is a powerful laser gun. Every time he turns on the laser gun, he can do exactly one of the two things:

  • Create a new energy bar.
  • Destroy a robot.

To avoid the extinction of robots, it's forbidden to destroy all the $$$n$$$ robots. It takes one dollar to turn on the laser gun once. You are asked to find the minimum cost of making a fair distribution.

Input

There are multiple test cases. The first line of the input contains an integer $$$T$$$ ($$$1 \le T \le 1\,000$$$), indicating the number of test cases. For each test case:

The only line contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n, m \le 10^8$$$), indicating the initial number of robots and energy bars.

Output

For each test case output one line containing an integer, indicating the minimum cost to get a fair distribution.

Example
Input
3
3 12
10 6
8 20
Output
0
4
2
Note

For the third sample, the best way is to destroy a robot and create an energy bar. After that, we have $$$7$$$ robots and $$$21$$$ energy bars, which leads to a fair distribution.