You are given two positive integers a and b. In one move you can increase a by 1 (replace a with a+1). Your task is to find the minimum number of moves you need to do in order to make a divisible by b. It is possible, that you have to make 0 moves, as a is already divisible by b. You have to answer t independent test cases.

Input

The first line of the input contains one integer t (1 ≤ t ≤ 10^4) — the number of test cases. Then t test cases follow.

The only line of the test case contains two integers a and b (1 ≤ a, b ≤ 10^9).

Output

For each test case print the answer — the minimum number of moves you need to do in order to make a divisible by b.

Example

Input


5
10 4
13 9
100 13
123 456
92 46


Output


2
5
4
333
0
import java.util.*;

public class codeforces2{
    public static char lowToUp(char x){
	if(x>='A'&&x<='Z'){
		int t=(int)x+32;
		return (char)t;
	}
	return x;
}
public static boolean lucky(int x){
	while(x!=0){
		if((x%10)!=4&&(x%10)!=7)return false;
		x=x/10;
	}
	return true;
}
public static int abs(int x){
	if(x<0)return -x;
	return x;
}
public static String lowToUp(String s){
	String r="";
	int t=0;
	for(int i=0;i<s.length();i++){
		if(s.charAt(i)>='A'&&s.charAt(i)<='Z'){
			t=(int)s.charAt(i)+32;
			r+=(char)t;
		}
		else{
			r+=s.charAt(i);
		}
	}
	return r;
}
public static boolean dist(int x){
	int[] z=new int[4];
	for(int i=0;i<4;i++){
		z[i]=x%10;
		x=x/10;
	}
	for(int i=0;i<3;i++){
		for(int j=i+1;j<4;j++){
			if(z[i]==z[j])return false;
		}
	}
	return true;
}
public static boolean exist(int[] x,int c){
	for(int i=0;i<x.length;i++){
		if(x[i]==c)return false;
	}
	return true;
}
public static boolean exist(char[] x,char c){
	for(int i=0;i<x.length;i++){
		if(x[i]==c)return false;
	}
	return true;
}
public static void display(int[] x){
	for(int i=0;i<x.length;i++)System.out.print(x[i]+" ");
}
public static void display(char[] x){
	for(int i=0;i<x.length;i++)System.out.print(x[i]+" ");
}
public static int[] sort(int [] arr){
	int temp=0;
    for (int i = 0; i < arr.length; i++) {
            for (int j = i+1; j < arr.length; j++) {
               if(arr[i] > arr[j]) {
                   temp = arr[i];
                   arr[i] = arr[j];
                   arr[j] = temp;
               }
            }
        }
        return arr;
}
public static boolean exist(String x,char c){
	for(int i=0;i<x.length();i++){
		if(x.charAt(i)==c)return false;
	}
	return true;
}
public static char[] rep(char[] x){
	String r="";
	for(int i=0;i<x.length;i++){
		if(exist(r,x[i]))r+=x[i];
	}
	char[] z=new char[r.length()];
	for(int i=0;i<r.length();i++){
		z[i]=r.charAt(i);
	}
	return z;
}
public static void main(String[] args){
   Scanner sc=new Scanner(System.in);
   /*int n=sc.nextInt();
   int[] x=new int[n];
   for(int i=0;i<n;i++)x[i]=sc.nextInt();
   int[] y=sort(x);
   int[] z=new int[n];
   int j=n-1;
   for(int i=0;i<n;i++){
   	z[i]=y[j];
   	j--;
   }
   int i=0;
   j=n-1;
   int t=0;
   int c=0;
   while(i<=j){
   	 c++;
   	 t=4-z[i];
   	 while(i<=j&&z[j]<=t){
   	 	t=t-z[j];
   	 	j--;
   	 }
   	 i++;
   }
   System.out.println(c);*/
   /*int n=sc.nextInt();
   int e=0;
   int o=0;
   int k=0;
   int z=0;
   for(int i=1;i<=n;i++){
   	int x=sc.nextInt();
   	if(x%2==0){
   		e++;
   		k=i;
   	}
   	else{
   		o++;
   		z=i;
   	}
   }
  if(e>o)System.out.println(z);
  else System.out.println(k);*/
   int n=sc.nextInt();
   for(int i=0;i<n;i++){
   	int a=sc.nextInt();
   	int b=sc.nextInt();
   	if(a%b==0)System.out.println(0);
   	else System.out.println(b-(a%b));

   }

}
}
