import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
BigInteger a,b;
Scanner sc=new Scanner(System.in);
int n;
n=sc.nextInt();
while(n-->0)
{
a=sc.nextBigInteger();
b=sc.nextBigInteger();
b=b.remainder(a);
System.out.println(b);
}
}
}
0 comments :
Post a Comment