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.util.*;
import java.io.*;
public class Main{


	public static void main (String args[])throws IOException{
		Scanner sc = new Scanner();
		PrintWriter out = new PrintWriter(System.out);
		
		int a = sc.nextInt(), b=sc.nextInt();
		if(a==b) {
			out.print(0);
		}
		else {
			if(a<b) {
				int temp=a;
				a=b;
				b=temp;
			}
			ArrayList<Integer> arr = new ArrayList();
			for(int i=1; i*i<=a-b; i++) {
				if((a-b)%i==0) {
					arr.add(i);
					arr.add((a-b)/i);
				}
			}
			long min=Long.MAX_VALUE, ans=0;
			for(int i=0; i<arr.size(); i++) {
				int q = arr.get(i);
				int k = ((int)Math.ceil((double)b/q)*q) - b;
				if(min>(long)(a+k)*(b+k)/q) {
					min=(long)(a+k)*(b+k)/q;
					ans = k;
				}
			}
			
			out.println(ans);
		}
		
		
		out.flush();
	}	

	
	
	
	
	
	
	
	
	
	

	static long power(long num, long power) {
		long temp=1;
		for(int i=0; i<power; i++) {
			temp*=num;
			if(temp>100000)
				return -1;
		}
		return temp;
	}
	
	static long nearestKthPower(long num, long k) {
		long temp=1, count=0, a=num;
		
		while(num%2==0) {
			num/=2;
			count++;
		}
		if(count>=k)
			count=count%k;
		else if(count!=0)
			count=k-count;
		while(count-->0) {
			temp*=2;
			if(temp>100000)
				return -1;
		}
		if(num==1)
			return temp;
		for(int i=3; i*i<=a; i+=2) {
			count=0;
			while(num%i==0) {
				num/=i;
				count++;
			}
			if(count>=k)
				count=count%k;
			else if(count!=0)
				count=k-count;
			while(count-->0) {
				temp*=i;
				if(temp>100000)
					return -1;
			}
			if(num==1)
				return temp;
		}
		if(num>1) {
			count=k-1;
			while(count-->0) {
				temp*=num;
				if(temp>100000)
					return -1;
			}
		}
		return temp;
			
	}
	
    static int[] primeGenerator(int num) {
    	int length=0, arr[]=new int[num], a=num, factor=1;
    	if(num%2==0) {
    		while(num%2==0) {
    			num/=2;
    			factor*=2;
    		}
    		arr[length++]=factor;
    	}
    	for(int i=3; i*i<=a; i++) {
    		factor=1;
    		if(num%i==0) {
        		while(num%i==0) {
        			num/=i;
        			factor*=i;
        		}
        		arr[length++]=factor;
    		}
    	}
    	if(num>1)
    		arr[length++]=num;
    	return Arrays.copyOfRange(arr, 0, length);
    }
    
    


    static boolean isPrime(int n) 
    { 
        // Corner cases 
        if (n <= 1) 
            return false; 
        if (n <= 3) 
            return true; 
  
        // This is checked so that we can skip 
        // middle five numbers in below loop 
        if (n % 2 == 0 || n % 3 == 0) 
            return false; 
  
        for (int i = 5; i * i <= n; i = i + 6) 
            if (n % i == 0 || n % (i + 2) == 0) 
                return false; 
  
        return true; 
    }












	static class Scanner {
		BufferedReader br;
		StringTokenizer st;

		Scanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		Scanner(String fileName) throws FileNotFoundException {
			br = new BufferedReader(new FileReader(fileName));
		}

		String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		String nextLine() throws IOException {
			return br.readLine();
		}

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

		long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		double nextDouble() throws NumberFormatException, IOException {
			return Double.parseDouble(next());
		}

		boolean ready() throws IOException {
			return br.ready();
		}

	}

	static void sort(int[] a) {
		shuffle(a);
		Arrays.sort(a);
	}

	static void shuffle(int[] a) {
		int n = a.length;
		Random rand = new Random();
		for (int i = 0; i < n; i++) {
			int tmpIdx = rand.nextInt(n);
			int tmp = a[i];
			a[i] = a[tmpIdx];
			a[tmpIdx] = tmp;
		}
	}
}


