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.util.*;

public class tr0 {
	static PrintWriter out;
	static StringBuilder sb;
	static int inf =(int) 1e7;
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		long a=sc.nextInt();
		long b=sc.nextInt();
		long lcm=(a*b)/gcd(a,b);
		long ans=0;
		long min=lcm;
		long dif=Math.abs(a-b);
		for(long d=1;d*d<=dif;d++) {
			if(dif%d!=0)
				continue;
			long k=1;
			k=d-Math.min(a, b)%d;
			long lcm1=((a+k)*(b+k))/gcd(b+k,a+k);
			if(lcm1<min || (lcm1==min && k<ans)) {
				ans=k;
				min=lcm1;
			}
			long d1=dif/d;
			k=d1-Math.min(a, b)%d1;
			lcm1=((a+k)*(b+k))/gcd(b+k,a+k);
			if(lcm1<min || (lcm1==min && k<ans)) {
				ans=k;
				min=lcm1;
			}
		}
		out.print(ans);
		out.flush();
	}
	static public class segmentTree{
		int [] array,tree,lazy;
		int n;
		segmentTree(int []aa){
			array=aa;
			n=array.length-1;
			tree=new int [n*4];
			lazy=new int[n*4];
			Arrays.fill(lazy, -1);
			build(1,1,n);
		}
		public String toString() {
			return Arrays.toString(tree);
		}
		void build(int node,int l,int r) {
			if(l==r)
				tree[node]=array[r];
			else {
				int mid=(l+r)>>1;
				build(node<<1,l,mid);
				build((node<<1)|1,mid+1,r);
				tree[node]=tree[node<<1]+tree[node<<1|1];
			}
		}
		void updateRange(int i,int j,int v) {
			updateR(1,1,n,i,j,v);
		}
		void updateR(int node,int l,int r,int i,int j,int v) {
			if(i>r || j<l)
				return;
			if(i<= l && j>=r) {
				tree[node] = (r-l+1)*v;			
				lazy[node] = v;
			}
			else {
				int mid=l+r>>1;
			propagate(node, l, mid, r);
			updateR(node<<1,l,mid,i,j,v);
			updateR(node<<1|1,mid+1,r,i,j,v);
			tree[node] = tree[node<<1] + tree[node<<1|1];
			}
		}
		void propagate(int node, int b, int mid, int e)		
		{
			if(lazy[node]!=-1) {
			lazy[node<<1] = lazy[node];
			lazy[node<<1|1] = lazy[node];
			tree[node<<1] = (mid-b+1)*lazy[node];		
			tree[node<<1|1] = (e-mid)*lazy[node];
			}
			lazy[node] = -1;
		}
		int query(int i, int j)
		{
			return query(1,1,n,i,j);
		}
		
		int query(int node, int b, int e, int i, int j)	// O(log n)
		{
			if(i>e || j <b)
				return 0;		
			if(b>= i && e <= j)
				return tree[node];
			int mid = b + e >> 1;
			propagate(node, b, mid, e);
			int q1 = query(node<<1,b,mid,i,j);
			int q2 = query(node<<1|1,mid+1,e,i,j);
			return q1 + q2;	
					
		}
		
	}
	static long mod=(long) 1e9+7;
     static long fac (int n) {
    	 if(n==0)
    		 return 1;
    	 if(n==1)
    		 return 1;
    	 long ans=1;
    	 for(int i=1;i<=n;i++)
    		 ans=(i%mod*ans%mod)%mod;
    	 return ans%mod;
     }
    	 static long gcd(long a, long b) {
     
		if (b == 0) {
			return a;
		}
		return gcd(b, a % b);
	}
    static class pair implements Comparable<pair>{
    	int num;
    	int v;
    	pair(int n,int v){
    		num=n;
    		this.v=v;
    	}
    	public String toString() {
    		return num+" "+v;
    	}
	
		public int compareTo(pair o) {
			return o.v-v;
		}
    }
	static class unionfind {
		int[] p;
		int[] size;

		unionfind(int n) {
			p = new int[n];
			size = new int[n];

			for (int i = 0; i < n; i++) {
				p[i] = i;
			}
			Arrays.fill(size, 1);
		}

		int findSet(int v) {
			if (v == p[v])
				return v;
			return p[v] = findSet(p[v]);
		}

		boolean sameSet(int a, int b) {
			a = findSet(a);
			b = findSet(b);
			if (a == b)
				return true;
			return false;
		}

		int max() {
			int max = 0;
			for (int i = 0; i < size.length; i++)
				if (size[i] > max)
					max = size[i];
			return max;
		}

		void combine(int a, int b) {
			a = findSet(a);
			b = findSet(b);
			if (a == b)
				return;
			if (size[a] > size[b]) {
				p[b] = a;
				size[a] += size[b];

			} else {
				p[a] = b;
				size[b] += size[a];
			}
		}
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

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

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

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

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

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

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}