Problem: You are given a positive integer n. In one move, you can increase n by one (i.e. make n := n + 1). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s.

You have to answer t independent test cases.

Input

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

The only line of the test case contains two integers n and s (1 ≤ n ≤ 10^{18}; 1 ≤ s ≤ 162).

Output

For each test case, print the answer: the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s.

Example

Input


5
2 1
1 1
500 4
217871987498122 10
100000000000000001 1


Output


8
0
500
2128012501878
899999999999999999

Solution (in PYTHON3):

Solution:
'''n = int(input())
if(n<=1):
    print("You cannot generate christmas tree");
 
elif(n>20):
    print("Tree is no more");
else:
    for i in range(n+1):
        for j in range(n):
            print(" ",end= "");
   
    for k in range(2*i+1):
        print("*",end= ""); 
   
    print("")
  
if(n>2):
    for s in range(n-1):
        for p in range(n-1):
            print(" ",end= "");   

        for q in range((2*(s+2))-1):
            print("*",end= ""); 

        for p in range(s,n-1):
            print(" ",end= "");  
        print("");  

    for t in range(n-3):
        for s in range(n-2):
            for p in range(s,n-1):
                print(" ",end= ""); 
            for q in range((2*(s+2))-1):
                print("*",end= ""); 
            for p in range(s,n-1):
                print(" ",end= "");   
     
    print(""); 
     
  
    for p in range(2):
        for q in range(n):
            print(" ",end= "");
    print("*",end= ""); 
   
    for q in range(n):
        print(" ",end= "");'''

def find(a,b):
    if(a<b):
        return((b-a))
    if(a>=b):
        q=a/b
        if(q==int(q)):
            return(0)
        else:
            cq = int(q) +1
            return(b*cq-a)
        
    '''
    '''


for i in range(int(input())):
    a,b = map(int,input().split())

    print(find(a,b))