Solve the following problem for test cases:
Given numbers, and , can you calculate mod ?
Constraints
Subtask 1 [50%]
Subtask 2 [50%]
No additional constraints.
Input Specification
The first line of input will contain .
The next lines of input contain two space-separated integers and .
Output Specification
For each test case, output mod .
Sample Input
2
2 5
11 9
Sample Output
240
8282605
Comments