Digo has received a PPO and is planning to give a chapo(treat) to all DIOGIO members. He has
set a budget of n rupees (n=whole number) and will invite 'm' no. of people. He would assign certain
integral sum of money for each person. Since he is fair/impartial, he would want that each of 'm' people
is assigned the same amount. Also he would like to spend as much as he could (But of course <=n). You
have to find 'x', the amount which remains with him after the treat, considering above conditions.
[Note: Consider only integral money everywhere]
[See explaination of sample test case for more clearity]
First line contains an integer t, representing the no. of test cases. Each of the next 't' lines contains two
integers, n and m.
For each test case, print an integer 'x' for that case on a separate line.
SAMPLE INPUT 1:
SAMPLE OUTPUT 1:
EXPLAINATION OF SAMPLE CASE:
For first case, digo will assign an amount=1 to each of 4 people. So he is left with 5-4*1=1.