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.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static long gcd(long pa,long pb){
        return pb==0?pa:gcd(pb,pa%pb);
    }
    //要使得最小公倍数最小，需要使得最大公约数最大，所以要遍历b-a的所有约数gcd，使得a+k的约数是gcd
    public static long lowestmultiple(long a,long b) {
        return a*b/gcd(a,b);
    }
    public static void main(String[] args) {
        //相加的数从0开始一直到，两者的最小公倍数 - 较小数
        Scanner in1 = new Scanner(System.in);
        while(in1.hasNext()) {
            long m1 = in1.nextLong();
            long m2 = in1.nextLong();
            if(m1 >m2){//确保m2>m1
                long temp = m2;
                m2 = m1;
                m1 = temp;
            }
            long min = lowestmultiple(m1, m2);
            long mini = 0;
            int diff =(int)(m2 - m1);
            List<Integer> list = new ArrayList<>();
            //求diff的全部约数
            for(int k=1;k*k<=diff;k++){
                if(diff % k ==0){
                    list.add(k);
                    list.add(diff/k);
                }
            }
            //遍历diff的全部约数i，使得i也是m1+t的约数
            for (int i1 = 0; i1 < list.size(); i1++) {
                long i = list.get(i1);
                long t =0;
                if(m1 % i != 0){//使得i也是m1+t的约数
                    t = i - m1 % i;
                }
                long nowmul = lowestmultiple(m1 + t, m2 + t);
                if ( nowmul< min ||(nowmul == min && t<mini)) {//有多解则打印最小的
                    min = nowmul;
                    mini = t;
                }
            }
            System.out.println(mini);
        }
    }
}

	  			 	 		 	      	  					  	