C. Combination Lock
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Given $$$3$$$ integers $$$x$$$, $$$y$$$, and $$$z$$$, you can perform three types of operations on them.

Swap the values of any $$$2$$$ of them ($$$x$$$ and $$$y$$$ or $$$x$$$ and $$$z$$$ or $$$y$$$ and $$$z$$$).

Choose one of them and increase the value of it by $$$1$$$

Choose one of them that is greater than $$$1$$$ and decrease the value of it by $$$1$$$.

Whats the minimum number of operations to make $$$x$$$ a factor of both $$$y$$$ and $$$z$$$?

Input

On the first line there will be the number of tests $$$t$$$ – ($$$1 \le t \le 100$$$).

On the first line of each test case there will be the $$$x$$$, $$$y$$$, and $$$z$$$ – ($$$1 \le x, y, z \le 10^4$$$).

Output

The answer for each test case will be a single integer on a single line.

Example
Input
4
10 25 35
10 9 11
1 10 20
3 2 1
Output
4
2
0
1
Note

In the first test case, we can decrease $$$x$$$ by $$$1$$$, increase $$$y$$$ by $$$2$$$, and increase $$$z$$$ by $$$1$$$.