Problem G: Sum of Digits

Problem G: Sum of Digits

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1028  Solved: 219
[Submit][Status][Web Board]

Description

Pisces has a positive integer \(n\). In one operation, Pisces can increase \(n\) by one (that is to say, make \(n=n+1\)). Pisces wants to know the minimum number of operations to make the sum of digits of \(n\) be no more than a given number \(s\).

Input

The first line of the input contains one integer \(t(1\leq t\leq 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\leq n\leq 10^{18},1\leq s\leq 162)\).

Output

For each test case, print the answer.

Sample Input

5
2 1
1 1
500 4
217871987498122 10
100000000000000001 1

Sample Output

8
0
500
2128012501878
899999999999999999

HINT

[Submit][Status]