# Decrease the Sum of Digits SOLUTIONS Codeforces Round #667 (Div. 3)

## Decrease the Sum of Digits SOLUTION

You are given a positive number n. In one move, you can build n by one (for example make n:=n+1). Your assignment is to locate the base number of moves you have to act so as to cause the total of digits of n to be not exactly or equivalent to s.

You need to answer t free experiments.

Info

The primary line of the info contains one whole number t (1≤t≤2⋅104) — the quantity of experiments. At that point t experiments follow.

The main line of the experiment contains two numbers n and s (1≤n≤1018; 1≤s≤162).

Yield

For each experiment, print the appropriate response: the base number of moves you have to act so as to cause the entirety of digits of n to be not exactly or equivalent to s.

Model

inputCopy

2 1

500 4

217871987498122 10

100000000000000001 1

outputCopy

500

2128012501878

### 2 thoughts on “Decrease the Sum of Digits SOLUTIONS Codeforces Round #667 (Div. 3)”

1. Thanks I followed your video even tho I don't understand what you were saying but I can understand the code, keep up the good work.

2. 