The problem is very simple. There are k children and n candies. The candies are to be divided among the children such that each child receives equal number of candies.
Find the number of remaining candies that could not be divided among the children.
Input
The first line contains an integer t denoting the total number of test cases.
Each of the next t lines contains 2 integers n and k denoting the number of candies and the children respectively.
Output
For each test case, print an integer denoting the remaining candies.
Constraints
t=105
1≤n≤1018
1≤k≤1018
Note: Since the n and k can be as large as 1018, storing them in integer variables would result in a wrong answer.