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 \le t \le 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 \le a, b \le 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

Difficulty: introductory

Starter code:

Solutions:
q = int(input())
for _ in range(q):
    a, b = list(map(int, input().split()))
    print((b - a % b) % b)


#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    t = I()
    for _ in range(t):
        a,b = LI()
        print(-a%b)
    return

#Solve
def __starting_point():
    solve()

__starting_point()

def solve():
    a, b = list(map(int, input().split()))
    print((b - a % b) % b)


for i in range(int(input())):
    solve()


for i in range(int(input())):
    a,b = map(int, input().split())
    if a % b == 0:
        print(0)
    else:
        print(b - a % b)

import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
  a, b = map(int, input().split())
  print(-a % b)

import sys
def input():
	return sys.stdin.readline()[:-1]
t = int(input())
for _ in range(t):
	a, b = map(int, input().split())
	if a%b == 0:
		print(0)
	else:
		print(b - a%b)

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

for _ in range(int(input())):
    a, b = list(map(int, input().split()))
    print((b - a % b) % b)


import sys
 
RI = lambda : [int(x) for x in sys.stdin.readline().split()]
ri = lambda : sys.stdin.readline().strip()

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return list(map(int, input().split()))
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
INF = 10 ** 18
MOD = 10 ** 9 + 7
 
for i in range(int(ri())):
    a,b = RI()

    temp = a%b
    if temp == 0:
        print(0)
    else:
        print(b-temp)




"""
    Template written to be used by Python Programmers.
    Use at your own risk!!!!
    Owned by enraged(rating - 5 star at CodeChef and Specialist at Codeforces).
"""
import sys
from functools import lru_cache
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
# sys.setrecursionlimit(2*pow(10, 6))
# sys.stdin = open("input.txt", "r")
# sys.stdout = open("output.txt", "w")
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var): sys.stdout.write(str(var))
def outln(var): sys.stdout.write(str(var)+"\n")
def l(): return list(sp())
def sl(): return list(ssp())
def sp(): return list(map(int, data().split()))
def ssp(): return list(map(str, data().split()))
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


for _ in range(int(data())):
    a, b = sp()
    temp = ceil(a/b)
    outln(temp*b-a)


t = int(input())
for _ in range(t):
    n, m = list(map(int, input().split()))
    print((m - n % m) % m)


#  =========     /\       /|    |====/|
#      |        /  \       |    |   / |
#      |       /____\      |    |  /  |
#      |      /      \     |    | /   |
#  ========= /        \  =====  |/====|  
#  code

# MOD = 998244353
# def pow(base , exp):
#     if exp == -1:
#         return pow(base , MOD - 2)
#     res = 1
#     base %= MOD
#     while exp > 0:
#         if exp % 2:
#             res = (res * base) % MOD
#         exp //= 2
#         base = (base * base) % MOD
    
#     res %= MOD
    #   return res

def main():
    t = int(input())
    for _ in range(t):
        a , b = map(int , input().split())
        if a % b == 0:
            print(0)
        else:
            print(b - a%b)
    return

def __starting_point():
    main()
__starting_point()

t=int(input())
for q in range(t):
    a,b=list(map(int,input().split()))
    print((b-a%b)%b)


t=int(input())
for i in range(t):
    a,b=list(map(int,input().split()))
    print((b-a%b)%b)


# from future import print_function,division
# range = xrange
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10**9)
from sys import stdin, stdout

def main():
    for _ in range(int(input())):
        a,b = [int(s) for s in input().split()]
        w = a//b
        w1  =a%b
        if w1==0:
            print(0)
        else:
            print(b-w1)


def __starting_point():
    main()
__starting_point()

for i in range(int(input())):
    n, m = list(map(int, input().split()))
    ch = n % m
    if ch == 0:
        ch = m
    print(m - ch)

t=int(input())
while t:
    a,b=map(int,input().split())
    if(a%b==0):print(0)
    else:print(b-a%b)
    t-=1

MOD = 1000000007
MOD2 = 998244353
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: map(int, input().split())
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(ii()):
    a,b=f()
    x=(b-(a%b))%b
    print(x)

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

import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy


ORDA = 97
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return [int(i) for i in input().split()]
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def revn(n): return str(n)[::-1]
def dd(): return collections.defaultdict(int)
def ddl(): return collections.defaultdict(list)
def sieve(n):
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r
def divs(n, start=1):
    r = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if (n % i == 0):
            if (n / i == i):
                r.append(i)
            else:
                r.extend([i, n // i])
    return r
def divn(n, primes):
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t
def prime(n):
    if n == 2: return True
    if n % 2 == 0 or n <= 1: return False
    sqr = int(math.sqrt(n)) + 1
    for d in range(3, sqr, 2):
        if n % d == 0: return False
    return True
def convn(number, base):
    newnumber = 0
    while number > 0:
        newnumber += number % base
        number //= base
    return newnumber
def cdiv(n, k): return n // k + (n % k != 0)


for _ in range(ii()):
    a, b = mi()
    print(b - a % b) if a % b else print(0)

n = int(input())
for i in range(n):
    a, b = map(int, input().split())
    c = a % b
    print((b - c) % b)

t = int(input())
for case_num in range(t):
    a, b = list(map(int, input().split(' ')))
    print((b - a % b) % b)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
import string

#########################
# imgur.com/Pkt7iIf.png #
#########################

def sieve(n):
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r

def divs(n, start=1):
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors

def divn(n, primes):
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t

def flin(d, x, default=-1):
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return default, default
    else:
        return left, right

def ceil(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def prr(a, sep=' '): print(sep.join(map(str, a)))
def dd(): return collections.defaultdict(int)
def ddl(): return collections.defaultdict(list)


# input = sys.stdin.readline

for _ in range(ii()):
    a, b = mi()
    t = ceil(a, b)
    print(b*t - a)