Given two non-negative integers and , determine the value of
modulo where
The first line contains one integer denoting the number of test cases.
Each of the following lines contains two integers indicating a test case.
For each test case, print one line containing one integer, the answer to the test case.
3 3 3 19 26 8 17
14 814 278
For the first test case:
So the answer is .