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
[{"code": "q = int(input())\nfor _ in range(q):\n    a, b = list(map(int, input().split()))\n    print((b - a % b) % b)\n", "passed": true, "time": 0.79, "memory": 14216.0, "status": "done"}, {"code": "#!usr/bin/env python3\nfrom collections import defaultdict, deque\nfrom heapq import heappush, heappop\nfrom itertools import permutations, accumulate\nimport sys\nimport math\nimport bisect\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef LS():return [list(x) for x in sys.stdin.readline().split()]\ndef S():\n    res = list(sys.stdin.readline())\n    if res[-1] == \"\\n\":\n        return res[:-1]\n    return res\ndef IR(n):\n    return [I() for i in range(n)]\ndef LIR(n):\n    return [LI() for i in range(n)]\ndef SR(n):\n    return [S() for i in range(n)]\ndef LSR(n):\n    return [LS() for i in range(n)]\n\nsys.setrecursionlimit(1000000)\nmod = 1000000007\n\ndef solve():\n    t = I()\n    for _ in range(t):\n        a,b = LI()\n        print(-a%b)\n    return\n\n#Solve\ndef __starting_point():\n    solve()\n\n__starting_point()", "passed": true, "time": 0.15, "memory": 14236.0, "status": "done"}, {"code": "def solve():\n    a, b = list(map(int, input().split()))\n    print((b - a % b) % b)\n\n\nfor i in range(int(input())):\n    solve()\n", "passed": true, "time": 0.15, "memory": 14136.0, "status": "done"}, {"code": "for i in range(int(input())):\n    a,b = map(int, input().split())\n    if a % b == 0:\n        print(0)\n    else:\n        print(b - a % b)", "passed": true, "time": 0.28, "memory": 14320.0, "status": "done"}, {"code": "import sys\ninput = sys.stdin.readline\nt = int(input())\nfor _ in range(t):\n  a, b = map(int, input().split())\n  print(-a % b)", "passed": true, "time": 0.22, "memory": 14140.0, "status": "done"}, {"code": "import sys\ndef input():\n\treturn sys.stdin.readline()[:-1]\nt = int(input())\nfor _ in range(t):\n\ta, b = map(int, input().split())\n\tif a%b == 0:\n\t\tprint(0)\n\telse:\n\t\tprint(b - a%b)", "passed": true, "time": 0.16, "memory": 14116.0, "status": "done"}, {"code": "t = int(input())\nfor i in range(t):\n    a, b = map(int, input().split())\n    print((b - a % b) % b)", "passed": true, "time": 0.14, "memory": 14148.0, "status": "done"}, {"code": "for _ in range(int(input())):\n    a, b = list(map(int, input().split()))\n    print((b - a % b) % b)\n", "passed": true, "time": 0.28, "memory": 14236.0, "status": "done"}, {"code": "import sys\n \nRI = lambda : [int(x) for x in sys.stdin.readline().split()]\nri = lambda : sys.stdin.readline().strip()\n\ndef input(): return sys.stdin.readline().strip()\ndef list2d(a, b, c): return [[c] * b for i in range(a)]\ndef list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]\ndef list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]\ndef ceil(x, y=1): return int(-(-x // y))\ndef INT(): return int(input())\ndef MAP(): return list(map(int, input().split()))\ndef LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]\ndef Yes(): print('Yes')\ndef No(): print('No')\ndef YES(): print('YES')\ndef NO(): print('NO')\nINF = 10 ** 18\nMOD = 10 ** 9 + 7\n \nfor i in range(int(ri())):\n    a,b = RI()\n\n    temp = a%b\n    if temp == 0:\n        print(0)\n    else:\n        print(b-temp)\n\n\n", "passed": true, "time": 0.19, "memory": 14332.0, "status": "done"}, {"code": "\"\"\"\n    Template written to be used by Python Programmers.\n    Use at your own risk!!!!\n    Owned by enraged(rating - 5 star at CodeChef and Specialist at Codeforces).\n\"\"\"\nimport sys\nfrom functools import lru_cache\nfrom heapq import merge, heapify, heappop, heappush\nfrom math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf\nfrom collections import defaultdict as dd, deque, Counter as c\nfrom itertools import combinations as comb, permutations as perm\nfrom bisect import bisect_left as bl, bisect_right as br, bisect\n# sys.setrecursionlimit(2*pow(10, 6))\n# sys.stdin = open(\"input.txt\", \"r\")\n# sys.stdout = open(\"output.txt\", \"w\")\nmod = pow(10, 9) + 7\nmod2 = 998244353\ndef data(): return sys.stdin.readline().strip()\ndef out(var): sys.stdout.write(str(var))\ndef outln(var): sys.stdout.write(str(var)+\"\\n\")\ndef l(): return list(sp())\ndef sl(): return list(ssp())\ndef sp(): return list(map(int, data().split()))\ndef ssp(): return list(map(str, data().split()))\ndef l1d(n, val=0): return [val for i in range(n)]\ndef l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]\n\n\nfor _ in range(int(data())):\n    a, b = sp()\n    temp = ceil(a/b)\n    outln(temp*b-a)\n", "passed": true, "time": 0.28, "memory": 14168.0, "status": "done"}, {"code": "t = int(input())\nfor _ in range(t):\n    n, m = list(map(int, input().split()))\n    print((m - n % m) % m)\n", "passed": true, "time": 0.19, "memory": 14144.0, "status": "done"}, {"code": "#  =========     /\\       /|    |====/|\n#      |        /  \\       |    |   / |\n#      |       /____\\      |    |  /  |\n#      |      /      \\     |    | /   |\n#  ========= /        \\  =====  |/====|  \n#  code\n\n# MOD = 998244353\n# def pow(base , exp):\n#     if exp == -1:\n#         return pow(base , MOD - 2)\n#     res = 1\n#     base %= MOD\n#     while exp > 0:\n#         if exp % 2:\n#             res = (res * base) % MOD\n#         exp //= 2\n#         base = (base * base) % MOD\n    \n#     res %= MOD\n    #   return res\n\ndef main():\n    t = int(input())\n    for _ in range(t):\n        a , b = map(int , input().split())\n        if a % b == 0:\n            print(0)\n        else:\n            print(b - a%b)\n    return\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.14, "memory": 14236.0, "status": "done"}, {"code": "t=int(input())\nfor q in range(t):\n    a,b=list(map(int,input().split()))\n    print((b-a%b)%b)\n", "passed": true, "time": 0.14, "memory": 14120.0, "status": "done"}, {"code": "t=int(input())\nfor i in range(t):\n    a,b=list(map(int,input().split()))\n    print((b-a%b)%b)\n", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "# from future import print_function,division\n# range = xrange\nimport sys\ninput = sys.stdin.readline\n# sys.setrecursionlimit(10**9)\nfrom sys import stdin, stdout\n\ndef main():\n    for _ in range(int(input())):\n        a,b = [int(s) for s in input().split()]\n        w = a//b\n        w1  =a%b\n        if w1==0:\n            print(0)\n        else:\n            print(b-w1)\n\n\ndef __starting_point():\n    main()\n__starting_point()", "passed": true, "time": 0.23, "memory": 14288.0, "status": "done"}, {"code": "for i in range(int(input())):\n    n, m = list(map(int, input().split()))\n    ch = n % m\n    if ch == 0:\n        ch = m\n    print(m - ch)", "passed": true, "time": 0.14, "memory": 14296.0, "status": "done"}, {"code": "t=int(input())\nwhile t:\n    a,b=map(int,input().split())\n    if(a%b==0):print(0)\n    else:print(b-a%b)\n    t-=1", "passed": true, "time": 0.14, "memory": 14144.0, "status": "done"}, {"code": "MOD = 1000000007\nMOD2 = 998244353\nii = lambda: int(input())\nsi = lambda: input()\ndgl = lambda: list(map(int, input()))\nf = lambda: map(int, input().split())\nil = lambda: list(map(int, input().split()))\nls = lambda: list(input())\nlet = 'abcdefghijklmnopqrstuvwxyz'\nfor _ in range(ii()):\n    a,b=f()\n    x=(b-(a%b))%b\n    print(x)", "passed": true, "time": 0.19, "memory": 14320.0, "status": "done"}, {"code": "t = int(input())\nfor i in range(t):\n    a, b = map(int, input().split())\n    print((b - a % b) % b)", "passed": true, "time": 0.14, "memory": 14244.0, "status": "done"}, {"code": "import sys\nimport math\nimport itertools\nimport functools\nimport collections\nimport operator\nimport fileinput\nimport copy\n\n\nORDA = 97\ndef ii(): return int(input())\ndef mi(): return map(int, input().split())\ndef li(): return [int(i) for i in input().split()]\ndef lcm(a, b): return abs(a * b) // math.gcd(a, b)\ndef revn(n): return str(n)[::-1]\ndef dd(): return collections.defaultdict(int)\ndef ddl(): return collections.defaultdict(list)\ndef sieve(n):\n    if n < 2: return list()\n    prime = [True for _ in range(n + 1)]\n    p = 3\n    while p * p <= n:\n        if prime[p]:\n            for i in range(p * 2, n + 1, p):\n                prime[i] = False\n        p += 2\n    r = [2]\n    for p in range(3, n + 1, 2):\n        if prime[p]:\n            r.append(p)\n    return r\ndef divs(n, start=1):\n    r = []\n    for i in range(start, int(math.sqrt(n) + 1)):\n        if (n % i == 0):\n            if (n / i == i):\n                r.append(i)\n            else:\n                r.extend([i, n // i])\n    return r\ndef divn(n, primes):\n    divs_number = 1\n    for i in primes:\n        if n == 1:\n            return divs_number\n        t = 1\n        while n % i == 0:\n            t += 1\n            n //= i\n        divs_number *= t\ndef prime(n):\n    if n == 2: return True\n    if n % 2 == 0 or n <= 1: return False\n    sqr = int(math.sqrt(n)) + 1\n    for d in range(3, sqr, 2):\n        if n % d == 0: return False\n    return True\ndef convn(number, base):\n    newnumber = 0\n    while number > 0:\n        newnumber += number % base\n        number //= base\n    return newnumber\ndef cdiv(n, k): return n // k + (n % k != 0)\n\n\nfor _ in range(ii()):\n    a, b = mi()\n    print(b - a % b) if a % b else print(0)", "passed": true, "time": 0.15, "memory": 14484.0, "status": "done"}, {"code": "n = int(input())\nfor i in range(n):\n    a, b = map(int, input().split())\n    c = a % b\n    print((b - c) % b)", "passed": true, "time": 0.14, "memory": 14324.0, "status": "done"}, {"code": "t = int(input())\nfor case_num in range(t):\n    a, b = list(map(int, input().split(' ')))\n    print((b - a % b) % b)\n", "passed": true, "time": 0.17, "memory": 14224.0, "status": "done"}, {"code": "import sys\nimport os\nimport time\nimport collections\nfrom collections import Counter, deque\nimport itertools\nimport math\nimport timeit\nimport random\nimport string\n\n#########################\n# imgur.com/Pkt7iIf.png #\n#########################\n\ndef sieve(n):\n    if n < 2: return list()\n    prime = [True for _ in range(n + 1)]\n    p = 3\n    while p * p <= n:\n        if prime[p]:\n            for i in range(p * 2, n + 1, p):\n                prime[i] = False\n        p += 2\n    r = [2]\n    for p in range(3, n + 1, 2):\n        if prime[p]:\n            r.append(p)\n    return r\n\ndef divs(n, start=1):\n    divisors = []\n    for i in range(start, int(math.sqrt(n) + 1)):\n        if n % i == 0:\n            if n / i == i:\n                divisors.append(i)\n            else:\n                divisors.extend([i, n // i])\n    return divisors\n\ndef divn(n, primes):\n    divs_number = 1\n    for i in primes:\n        if n == 1:\n            return divs_number\n        t = 1\n        while n % i == 0:\n            t += 1\n            n //= i\n        divs_number *= t\n\ndef flin(d, x, default=-1):\n    left = right = -1\n    for i in range(len(d)):\n        if d[i] == x:\n            if left == -1: left = i\n            right = i\n    if left == -1:\n        return default, default\n    else:\n        return left, right\n\ndef ceil(n, k): return n // k + (n % k != 0)\ndef ii(): return int(input())\ndef mi(): return map(int, input().split())\ndef li(): return list(map(int, input().split()))\ndef lcm(a, b): return abs(a * b) // math.gcd(a, b)\ndef prr(a, sep=' '): print(sep.join(map(str, a)))\ndef dd(): return collections.defaultdict(int)\ndef ddl(): return collections.defaultdict(list)\n\n\n# input = sys.stdin.readline\n\nfor _ in range(ii()):\n    a, b = mi()\n    t = ceil(a, b)\n    print(b*t - a)", "passed": true, "time": 0.15, "memory": 14376.0, "status": "done"}]