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.
#include <bits/stdc++.h>
int N = 1e6, SZ = 320, INF = 1 << 29;
long long LINF = (1LL << 61), mod = 1e9 + 7;
const long double eps = 1e-9, PI = acos(-1.0);
using namespace std;
char READ_DATA;
int SIGNAL_INPUT;
template <typename Type>
inline Type ru(Type &v) {
  SIGNAL_INPUT = 1;
  while ((READ_DATA = getchar()) < '0' || READ_DATA > '9')
    if (READ_DATA == '-')
      SIGNAL_INPUT = -1;
    else if (READ_DATA == EOF)
      return EOF;
  v = READ_DATA - '0';
  while ((READ_DATA = getchar()) >= '0' && READ_DATA <= '9')
    v = v * 10 + READ_DATA - '0';
  v *= SIGNAL_INPUT;
  return v;
}
inline long long modru(long long &v) {
  long long p = 0;
  SIGNAL_INPUT = 1;
  while ((READ_DATA = getchar()) < '0' || READ_DATA > '9')
    if (READ_DATA == '-')
      SIGNAL_INPUT = -1;
    else if (READ_DATA == EOF)
      return EOF;
  p = v = READ_DATA - '0';
  while ((READ_DATA = getchar()) >= '0' && READ_DATA <= '9') {
    v = (v * 10 + READ_DATA - '0') % mod;
    p = (p * 10 + READ_DATA - '0') % (mod - 1);
  }
  v *= SIGNAL_INPUT;
  return p;
}
template <typename A, typename B>
inline int ru(A &x, B &y) {
  if (ru(x) == EOF) return EOF;
  ru(y);
  return 2;
}
template <typename A, typename B, typename C>
inline int ru(A &x, B &y, C &z) {
  if (ru(x) == EOF) return EOF;
  ru(y);
  ru(z);
  return 3;
}
template <typename A, typename B, typename C, typename D>
inline int ru(A &x, B &y, C &z, D &w) {
  if (ru(x) == EOF) return EOF;
  ru(y);
  ru(z);
  ru(w);
  return 4;
}
inline long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
inline long long fastmul(long long a, long long b, long long mod = 1e9 + 7) {
  return (a * b - (long long)((long double)a * b / mod) * mod + mod) % mod;
}
inline long long dirmul(long long a, long long b, long long mod = 1e9 + 7) {
  return a * b % mod;
}
inline long long ss(long long a, long long b, long long mod = 1e9 + 7,
                    long long (*mul)(long long, long long,
                                     long long) = dirmul) {
  if (b < 0) {
    b = -b;
    a = ss(a, mod - 2, mod);
  }
  long long ans = 1;
  while (b) {
    if (b & 1) ans = mul(ans, a, mod);
    a = mul(a, a, mod);
    b >>= 1;
  }
  return ans;
}
inline int isprime(long long n) {
  if (n == 1) return 0;
  for (long long d = 2; d * d <= n; ++d) {
    if (n % d == 0) return 0;
  }
  return 1;
}
template <typename Type>
void brc(Type *a, int n) {
  int k;
  for (int i = 1, j = n / 2; i < n - 1; i++) {
    if (i < j) swap(a[i], a[j]);
    k = n >> 1;
    while (j >= k) {
      j ^= k;
      k >>= 1;
    }
    if (j < k) j ^= k;
  }
}
void fft(complex<double> *a, int n, int inv = 1) {
  complex<double> u, t;
  brc(a, n);
  for (int h = 2; h <= n; h <<= 1) {
    complex<double> wn(cos(inv * 2.0 * PI / h), sin(inv * 2.0 * PI / h));
    for (int j = 0; j < n; j += h) {
      complex<double> w(1, 0);
      for (int k = j; k < j + (h >> 1); k++) {
        u = a[k];
        t = w * a[k + (h >> 1)];
        a[k] = u + t;
        a[k + (h >> 1)] = u - t;
        w *= wn;
      }
    }
  }
  if (inv == -1)
    for (int i = 0; i < n; ++i) a[i] /= n;
}
void ntt(long long *a, int n, int inv = 1) {
  long long u, t;
  brc(a, n);
  for (int h = 2; h <= n; h <<= 1) {
    long long wn = ss(3, (mod - 1) / h);
    if (inv == -1) wn = ss(wn, mod - 2);
    for (int j = 0; j < n; j += h) {
      long long w = 1;
      for (int k = j; k < j + (h >> 1); k++) {
        u = a[k];
        t = w * a[k + (h >> 1)] % mod;
        a[k] = (u + t) % mod;
        a[k + (h >> 1)] = (u - t + mod) % mod;
        (w *= wn) %= mod;
      }
    }
  }
  if (inv == -1) {
    long long tmp = ss(n, mod - 2);
    for (int i = 0; i < n; ++i) (a[i] *= tmp) %= mod;
  }
}
struct Edge {
  int u, v, nxt;
  int w;
  Edge(int _u = 0, int _v = 0, int _w = 0, int _nxt = 0) {
    u = _u;
    v = _v;
    w = _w;
    nxt = _nxt;
  }
  int operator<(const Edge &b) const { return w < b.w; }
};
const int maxn = 3e5 + 5;
long long a, b;
int main() {
  ru(a, b);
  if (a < b) swap(a, b);
  long long ans = 0, lcm = a * b / gcd(a, b);
  long long tmp = a - b;
  for (long long d = 1; d * d <= tmp; d++) {
    if (tmp % d == 0) {
      long long k = d - b % d;
      long long cal = (a + k) / gcd(a + k, b + k) * (b + k);
      if (cal < lcm) {
        lcm = cal;
        ans = k;
      } else if (cal == lcm)
        ans = min(ans, k);
      d = tmp / d;
      k = d - b % d;
      cal = (a + k) / gcd(a + k, b + k) * (b + k);
      if (cal < lcm) {
        lcm = cal;
        ans = k;
      } else if (cal == lcm)
        ans = min(ans, k);
      d = tmp / d;
    }
  }
  cout << ans;
}
