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 R554C
{

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int b = scan.nextInt();
		if (a == b)
		{
			System.out.println(0);
			return;
		}
		if (a > b)
		{
			int t = a;
			a = b;
			b = t;
		}
		if(gcd(a, b) == a){
			System.out.println(0);
			return;
		}
		int d = b-a;
		if (a >= d)
		{
			int x = d-a%d;
			if(lcm(a+x, b+x) >= lcm(a, b)) System.out.println(0);
			else System.out.println(x);
			return;
		}
		ArrayList<Long> factors = getFactors(d);
		long ans = Long.MAX_VALUE;
		for (long f : factors)
		{
			if (f > a)
				ans = Math.min(ans, f-a);
		}
		if(lcm(a+ans, b+ans) >= lcm(a, b))	System.out.println(0);
		else System.out.println(ans);
	}

	static ArrayList<Long> getFactors(long d){
		ArrayList<Long> f = new ArrayList<Long>();
		long cpy = d;
		for(long i = 1; i*i <= d; i++) {
			if(cpy%i == 0) {
				if(i != cpy/i) {
					f.add(i);
					f.add(cpy/i);
				}
				else {
					f.add(i);
				}
			}
		}
		return f;
	}

	static long lcm(long a, long b) {
		return a/gcd(a,b)*b;
	}

	static long gcd(long a, long b) {
		if(b == 0) return a;
		return gcd(b, a%b);
	}

	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}				
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}
}
