P13145 [HackerEarth] pranav and tle
普及
题目描述

Pranav just learned about Modulus(%) and trying to solve a problem on Modulus but he always get TLE. Your task is to help him. Problem is simple, you have been given two numbers A and M and you have to find A%M and print it.

Input Format

Firstline: T, where T is the number of test cases. Now T line followed, Where each line consist of A and M space separated.

Constraints :

1 ≤T ≤ 100

Number of digit in A ≤ 5×10^5

1 ≤ M ≤ 10^9

Output Format

Print A%M in a new line.

Sample Input

2

12344 12

12 123

Sample Output

8

12

NOTE Only C/C++ is allowed for this challenge.

SAMPLE INPUT
2
12344 12
12 123

SAMPLE OUTPUT
8
12

输入格式

见题面

输出格式

见题面

样例输入
2 12344 12 12 123 SAMPLE
样例输出
8 12