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.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author null
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Input in = new Input(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF1152C solver = new CF1152C();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF1152C {
        public void solve(int testNumber, Input in, PrintWriter out) {
            try {
                long a = in.readInt();
                long b = in.readInt();
                long min = Long.MAX_VALUE;
                long ans = -1;
                for (int k = 0; k < 1000000; k++) {
                    long g = (a + k) * (b + k) / GCD.gcd(a + k, b + k);
                    if (g < min) {
                        min = g;
                        ans = k;
                    }
                }

                long d = Math.abs(a - b);
                for (long i = 1; i * i <= d; i++) {
                    if (d % i == 0) {
                        long k = i - a % i;
                        long g = (a + k) * (b + k) / GCD.gcd(a + k, b + k);
                        if (g < min) {
                            min = g;
                            ans = k;
                        }

                        k = (d / i) - a % (d / i);
                        g = (a + k) * (b + k) / GCD.gcd(a + k, b + k);
                        if (g < min) {
                            min = g;
                            ans = k;
                        }
                    }
                }

                if (a != b) {
                    long k = Math.abs(a - b) - a % Math.abs(a - b);
                    long g = (a + k) * (b + k) / GCD.gcd(a + k, b + k);
                    if (g < min) {
                        min = g;
                        ans = k;
                    }
                }
                out.println(ans);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

    }

    static class Input {
        public final BufferedReader reader;
        private String line = "";
        private int pos = 0;

        public Input(InputStream inputStream) {
            reader = new BufferedReader(new InputStreamReader(inputStream));
        }

        private boolean isSpace(char ch) {
            return ch <= 32;
        }

        public String readWord() throws IOException {
            skip();
            int start = pos;
            while (pos < line.length() && !isSpace(line.charAt(pos))) {
                pos++;
            }
            return line.substring(start, pos);
        }

        public int readInt() throws IOException {
            return Integer.parseInt(readWord());
        }

        private void skip() throws IOException {
            while (true) {
                if (pos >= line.length()) {
                    line = reader.readLine();
                    pos = 0;
                }
                while (pos < line.length() && isSpace(line.charAt(pos))) {
                    pos++;
                }
                if (pos < line.length()) {
                    return;
                }
            }
        }

    }

    static class GCD {
        public static long gcd(long a, long b) {
            if (a < 0) {
                return gcd(-a, b);
            }
            if (b < 0) {
                return gcd(a, -b);
            }
            if (a < b) {
                return gcd(b, a);
            }
            while (b > 0) {
                long c = a % b;
                a = b;
                b = c;
            }
            return a;
        }

    }
}

