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:
#136A
# num = int(input())
# arr = []
# arr = [i for i in input().split()][:num]
# newarr = []
# for i in range(1,len(arr)+1):
#     newarr.append(str(arr.index(str(i)) + 1))
# print(" ".join(newarr))

#486A
# num = int(input())
# if num%2 == 0:
#     print(int(num/2))
# else:
#     x = int((num/2)+1)
#     print(-x)

#144A
# num = int(input())
# arr = []
# arr = [i for i in input().split()][:num]
# max = max(arr)
# max_index = arr.index(max)
# a= [i for i, x in enumerate(arr) if x == max]
# max_index = a[0]
# min = min(arr)
# min_index = arr.index(min)
# a= [i for i, x in enumerate(arr) if x == min]
# min_index = a[len(a)-1]
# if max_index>min_index:
# 	print(num - 1 - min_index + max_index -1)
# else:
# 	print(num - min_index - 1 + max_index)
#
#
#
# k = 0
# r = 0
# arr = [i for i in input().split()][:num]
# max = max(arr)
# max_index = arr.index(max)
# a= [i for i, x in enumerate(arr) if x == max]
# max_index = a[0]
# for i in range(int(max_index),0, -1):
#     arr[i-1], arr[i] = arr[i], arr[i-1]
#     k = k + 1
# min = min(arr)
# a= [i for i, x in enumerate(arr) if x == min]
# min_index = a[len(a)-1]
# for i in range(int(min_index),len(arr)-1):
#     arr[i+1], arr[i] = arr[i], arr[i+1]
#     r = r + 1
# print(r+k)
#

#1328A
num = int(input())
div = []
for i in range(num):
	arr = [i for i in input().split()][:2]
	j = 0
	if int(arr[0]) % int(arr[1]) == 0:
		div.append(0)
	else:
		div.append(int(arr[1])  - int(arr[0])  % int(arr[1]) )
	# while int(arr[0]) % int(arr[1]) != 0:
	# 	arr[0] = int(arr[0])+1
	# 	j=j+1
	# div.append(j)
print(*div, sep = "\n")