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.*;
import java.lang.*;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;
import java.math.BigInteger;

public class Warmup {
    //code written by a living bruh moment
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        int t = 1;
        for(int tt = 1; tt<=t; tt++) solver.solve(tt,in,out);
        out.close();
    }
    static class Task{

        public void solve(int tt, InputReader in, PrintWriter out){
            long a = in.nextLong();
            long b = in.nextLong();
            if(b<a){
                long temp = b;
                b = a;
                a = temp;
            }
            long k = b-a;
            int count = 0;
            long minlcm = (long) 2e12;
            ArrayList<Long> factors = new ArrayList<Long>();
            for(long i = 1; i*i<=k; i++){
                if(k%i==0){
                    if(k/i==i) factors.add(i);
                    else{
                        factors.add(i);
                        factors.add(k/i);
                    }
                }
            }
            for(long i : factors){
                long doit = i - (a%i);
                long temp = lcm(a+doit,b+doit);
                if(temp<minlcm){
                    count = (int)doit;
                    minlcm = temp;
                }
            }
            if(lcm(a,b)<=minlcm){
                out.println(0);
                return;
            }
            out.println(count);
        }
    }
    static void check(long i){

    }
    static long lcm(long a, long b){
        return a * b / gcd(a,b);
    }
    static long gcd(long a, long b){
        if(b==0){
            return a;
        }
        return gcd(b, a%b);
    }
    static void sort(int[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static void sort(long[] x){
		shuffle(x);
		Arrays.sort(x);
	}
	static void shuffle(int[] a) {
	    Random get = new Random();
	    for (int i = 0; i < a.length; i++) {
	        int r = get.nextInt(a.length);
	        int temp = a[i];
	        a[i] = a[r];
	        a[r] = temp;
	    }
	}
	static void shuffle(long[] a) {
	    Random get = new Random();
	    for (int i = 0; i < a.length; i++) {
	        int r = get.nextInt(a.length);
	        long temp = a[i];
	        a[i] = a[r];
	        a[r] = temp;
	    }
	}
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }

        public boolean hasNext() {
            String next = null;
            try {
                next = reader.readLine();
            } catch (Exception e) {
            }
            if (next == null) {
                return false;
            }
            tokenizer = new StringTokenizer(next);
            return true;
        }
        public int[] nextInta(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

        public long[] nextLonga(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++) a[i] = nextLong();
            return a;
        }

        public int[][] nextIntm(int n, int m) {
            int[][] a = new int[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    a[i][j] = nextInt();
                }
            }
            return a;
        }

        public long[][] nextLongm(int n, int m) {
            long[][] a = new long[n][m];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    a[i][j] = nextLong();
                }
            }
            return a;
        }
        public BigInteger nextBigInteger() {
            return new BigInteger(next());
        }
    }
}