Time Limit: 1000 MS    Memory Limit: 65536 K 


Description

You are given a original number N. Can you tell me the smallest non-negative integer that can be added to N such that the resulting integer contains at least two digits K.

Input

The first line of the input data will be a integer to represent the number of test cases. For each case there is only one line contains two integers N and K. ( 0 <= N < 10^10000 , 0 <= K <= 9 ) There is a blank line before each test case.

Output

For each test case output the answer on a single line: the smallest non-negative integer.

Sample Input

6 219 2 1 1 5 2 999 1 878 8 19999 2

Sample Output

1 10 17 2 0 3

Source