#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
constexpr int INF = 1000000000;
constexpr long long llINF = 1000000000000000000;
constexpr int mod = 998244353;
constexpr double eps = 1e-8;
const double pi = acos(-1);
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int Random(int mi, int ma) {
  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<int> engine(mi, ma);
  return engine(mt);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
bool prime(int a) {
  if (a == 1) return false;
  for (int i = 2; i * i <= a; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
int modpow(int a, int b) {
  if (b == 0) return 1;
  if (b % 2) return modpow(a, b - 1) * a % mod;
  int memo = modpow(a, b / 2);
  return memo * memo % mod;
}
vector<int> kaijo, invkaijo;
void init_fact(int n) {
  kaijo.resize(n + 1);
  invkaijo.resize(n + 1);
  kaijo[0] = 1;
  for (int i = 1; i <= n; i++) {
    kaijo[i] = kaijo[i - 1] * i;
    kaijo[i] %= mod;
  }
  for (int i = 0; i < n + 1; i++) invkaijo[i] = modpow(kaijo[i], mod - 2);
}
int comb(int a, int b) {
  if (a < b) return 0;
  if (a < 0 || b < 0) return 0;
  return kaijo[a] * invkaijo[a - b] % mod * invkaijo[b] % mod;
}
int inv(int x) {
  x = modpow(x, mod - 2);
  return x;
}
int digit_sum(long long n) {
  int res = 0;
  while (n) {
    res += n % 10;
    n /= 10;
  }
  return res;
}
void solve() {
  long long n, ans = 0;
  int s;
  cin >> n >> s;
  while (digit_sum(n) > s) {
    string m = to_string(n);
    long long p = 1;
    for (int i = m.size() - 1; i >= 0; i--) {
      if (m[i] != '0') {
        ans += p * (10 - (m[i] - '0'));
        n += p * (10 - (m[i] - '0'));
        break;
      }
      p *= 10;
    }
  }
  cout << ans << endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}

### Prompt

Please formulate a Cpp solution to the following problem:

You are given a positive integer n. In one move, you can increase n by one (i.e. make n := n + 1). Your task is to find the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s.

You have to answer t independent test cases.

Input

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

Output

For each test case, print the answer: the minimum number of moves you need to perform in order to make the sum of digits of n be less than or equal to s.

Example

Input


5
2 1
1 1
500 4
217871987498122 10
100000000000000001 1


Output


8
0
500
2128012501878
899999999999999999

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
void chmin(T &a, T b) {
  if (a > b) a = b;
}
constexpr int INF = 1000000000;
constexpr long long llINF = 1000000000000000000;
constexpr int mod = 998244353;
constexpr double eps = 1e-8;
const double pi = acos(-1);
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int Random(int mi, int ma) {
  random_device rnd;
  mt19937 mt(rnd());
  uniform_int_distribution<int> engine(mi, ma);
  return engine(mt);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int lcm(int a, int b) { return a / gcd(a, b) * b; }
bool prime(int a) {
  if (a == 1) return false;
  for (int i = 2; i * i <= a; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
int modpow(int a, int b) {
  if (b == 0) return 1;
  if (b % 2) return modpow(a, b - 1) * a % mod;
  int memo = modpow(a, b / 2);
  return memo * memo % mod;
}
vector<int> kaijo, invkaijo;
void init_fact(int n) {
  kaijo.resize(n + 1);
  invkaijo.resize(n + 1);
  kaijo[0] = 1;
  for (int i = 1; i <= n; i++) {
    kaijo[i] = kaijo[i - 1] * i;
    kaijo[i] %= mod;
  }
  for (int i = 0; i < n + 1; i++) invkaijo[i] = modpow(kaijo[i], mod - 2);
}
int comb(int a, int b) {
  if (a < b) return 0;
  if (a < 0 || b < 0) return 0;
  return kaijo[a] * invkaijo[a - b] % mod * invkaijo[b] % mod;
}
int inv(int x) {
  x = modpow(x, mod - 2);
  return x;
}
int digit_sum(long long n) {
  int res = 0;
  while (n) {
    res += n % 10;
    n /= 10;
  }
  return res;
}
void solve() {
  long long n, ans = 0;
  int s;
  cin >> n >> s;
  while (digit_sum(n) > s) {
    string m = to_string(n);
    long long p = 1;
    for (int i = m.size() - 1; i >= 0; i--) {
      if (m[i] != '0') {
        ans += p * (10 - (m[i] - '0'));
        n += p * (10 - (m[i] - '0'));
        break;
      }
      p *= 10;
    }
  }
  cout << ans << endl;
}
signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}

```