#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
T amax(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
bool isPrime(long long x) {
  if (x == 1) return false;
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
bool isPowerOfTwo(long long n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
long long gcdByBit(long long a, long long b) {
  if (!a || !b) return a | b;
  unsigned shift = __builtin_ctz(a | b);
  a >>= __builtin_ctzl(a);
  do {
    b >>= __builtin_ctzl(b);
    if (a > b) {
      swap(a, b);
    }
    b -= a;
  } while (b);
  return a << shift;
}
long long powerMod(long long n, long long p) {
  long long res = 1;
  while (p) {
    if (p % 2 == 0) {
      n = n * 1ll * n % 1000000007;
      p /= 2;
    } else {
      res = res * 1ll * n % 1000000007;
      p--;
    }
  }
  return res;
}
long long powerMod2(long long b, long long p, long long m) {
  if (p == 0) return 1;
  return (b * powerMod2(b, p - 1, m) % m) % m;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 1; i <= n; i++) {
    res = res * 1ll * i % 1000000007;
  }
  return res;
}
long long nCr(long long n, long long r) {
  return fact(n) * 1ll * powerMod(fact(r), 1000000007 - 2) % 1000000007 * 1ll *
         powerMod(fact(n - r), 1000000007 - 2) % 1000000007;
}
void ans() {
  long long a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  vector<long long> v;
  for (long long i = 1; i * i <= b - a; i++) {
    if ((b - a) % i == 0) {
      v.push_back((b - a) / i);
      v.push_back(i);
    }
  }
  long long ans = 1e18, m;
  for (long long i = 0; i < v.size(); i++) {
    long long w = 0;
    if (a % v[i] != 0) w = v[i] - a % v[i];
    long long temp = (a + w) * (b + w) / gcdByBit(a + w, b + w);
    if (ans > temp) {
      ans = temp;
      m = w;
    }
  }
  if (a == b) m = 0;
  cout << m << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tc = 1;
  while (tc--) {
    ans();
  }
  return 0;
}

### Prompt

Please formulate a CPP solution to the following problem:

Neko loves divisors. During the latest number theory lesson, he got an interesting exercise from his math teacher.

Neko has two integers a and b. His goal is to find a non-negative integer k such that the least common multiple of a+k and b+k is the smallest possible. If there are multiple optimal integers k, he needs to choose the smallest one.

Given his mathematical talent, Neko had no trouble getting Wrong Answer on this problem. Can you help him solve it?

Input

The only line contains two integers a and b (1 ≤ a, b ≤ 10^9).

Output

Print the smallest non-negative integer k (k ≥ 0) such that the lowest common multiple of a+k and b+k is the smallest possible.

If there are many possible integers k giving the same value of the least common multiple, print the smallest one.

Examples

Input


6 10


Output


2

Input


21 31


Output


9

Input


5 10


Output


0

Note

In the first test, one should choose k = 2, as the least common multiple of 6 + 2 and 10 + 2 is 24, which is the smallest least common multiple possible.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
template <typename T, typename T1>
T amax(T &a, T1 b) {
  if (b > a) a = b;
  return a;
}
template <typename T, typename T1>
T amin(T &a, T1 b) {
  if (b < a) a = b;
  return a;
}
bool isPrime(long long x) {
  if (x == 1) return false;
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
bool isPowerOfTwo(long long n) {
  if (n == 0) return false;
  return (ceil(log2(n)) == floor(log2(n)));
}
long long gcdByBit(long long a, long long b) {
  if (!a || !b) return a | b;
  unsigned shift = __builtin_ctz(a | b);
  a >>= __builtin_ctzl(a);
  do {
    b >>= __builtin_ctzl(b);
    if (a > b) {
      swap(a, b);
    }
    b -= a;
  } while (b);
  return a << shift;
}
long long powerMod(long long n, long long p) {
  long long res = 1;
  while (p) {
    if (p % 2 == 0) {
      n = n * 1ll * n % 1000000007;
      p /= 2;
    } else {
      res = res * 1ll * n % 1000000007;
      p--;
    }
  }
  return res;
}
long long powerMod2(long long b, long long p, long long m) {
  if (p == 0) return 1;
  return (b * powerMod2(b, p - 1, m) % m) % m;
}
long long fact(long long n) {
  long long res = 1;
  for (long long i = 1; i <= n; i++) {
    res = res * 1ll * i % 1000000007;
  }
  return res;
}
long long nCr(long long n, long long r) {
  return fact(n) * 1ll * powerMod(fact(r), 1000000007 - 2) % 1000000007 * 1ll *
         powerMod(fact(n - r), 1000000007 - 2) % 1000000007;
}
void ans() {
  long long a, b;
  cin >> a >> b;
  if (a > b) swap(a, b);
  vector<long long> v;
  for (long long i = 1; i * i <= b - a; i++) {
    if ((b - a) % i == 0) {
      v.push_back((b - a) / i);
      v.push_back(i);
    }
  }
  long long ans = 1e18, m;
  for (long long i = 0; i < v.size(); i++) {
    long long w = 0;
    if (a % v[i] != 0) w = v[i] - a % v[i];
    long long temp = (a + w) * (b + w) / gcdByBit(a + w, b + w);
    if (ans > temp) {
      ans = temp;
      m = w;
    }
  }
  if (a == b) m = 0;
  cout << m << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tc = 1;
  while (tc--) {
    ans();
  }
  return 0;
}

```