After dating for a long time, Akhil is finally going to propose to his girlfriend. She is very strong in mathematics, and will accept his proposal, if and only if Akhil solves a problem given by her. The problem is given below. Help Akhil solve it.
Akhil is given two numbers N and M, and he has to tell her the remainder when is divided by .
Input Format
The first line contains an integer i.e. the number of test cases.
Each of the next lines contain two space separated integers, and .
Output Format
lines each containing ouptut for the corresponding test case.
Constraints
Sample Input 00
3
3 3
4 7
5 18
Sample Output 00
0
5
5
Explanation
111 % 3 = 0
1111 % 7 = 5
11111%18 = 5