Two little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The bears are so greedy that they are ready to fight for the larger piece. That's where the fox comes in and starts the dialog: "Little bears, wait a little, I want to make your pieces equal" "Come off it fox, how are you going to do that?", the curious bears asked. "It's easy", said the fox. "If the mass of a certain piece is divisible by two, then I can eat exactly a half of the piece. If the mass of a certain piece is divisible by three, then I can eat exactly two-thirds, and if the mass is divisible by five, then I can eat four-fifths. I'll eat a little here and there and make the pieces equal". 

The little bears realize that the fox's proposal contains a catch. But at the same time they realize that they can not make the two pieces equal themselves. So they agreed to her proposal, but on one condition: the fox should make the pieces equal as quickly as possible. Find the minimum number of operations the fox needs to make pieces equal.

Input

The first line contains two space-separated integers a and b (1 ≤ a, b ≤ 109). 

Output

If the fox is lying to the little bears and it is impossible to make the pieces equal, print -1. Otherwise, print the required minimum number of operations. If the pieces of the cheese are initially equal, the required number is 0.

Examples

Input

15 20


Output

3


Input

14 8


Output

-1


Input

6 6


Output

0
import java.util.*;
import java.io.*;;

public class E {

	static ArrayList<Integer> primes; // generated by sieve

	/*
	 * 1. Generating a list of prime factors of N
	 */
	static int[] primeFactors(int N) // O(sqrt(N) / ln sqrt(N))
	{
		int[] factors = new int[100000];// take abs(N) in case of -ve integers
		int idx = 0, p = primes.get(idx);

		while (p * 1l * p <= N) {
			int c = 0;
			while (N % p == 0) {
				N /= p;
				c++;
			}
			factors[p] += c;
			p = primes.get(++idx);
		}

		if (N != 1) { // last prime factor may be > sqrt(N)
			if (N > 100000)
				factors[factors.length - 1] = N;
			else
				factors[N]++;
		} // for integers whose largest prime factor has a power of 1
		return factors;
	}

	static int[] isComposite;

	static void sieve(int N) // O(N log log N)
	{
		isComposite = new int[N + 1];
		isComposite[0] = isComposite[1] = 1; // 0 indicates a prime number
		primes = new ArrayList<Integer>();

		for (int i = 2; i <= N; ++i) // can loop till i*i <= N if primes array is not needed O(N log log sqrt(N))
			if (isComposite[i] == 0) // can loop in 2 and odd integers for slightly better performance
			{
				primes.add(i);
				if (1l * i * i <= N)
					for (int j = i * i; j <= N; j += i) // j = i * 2 will not affect performance too much, may alter in
														// modified sieve
						isComposite[j] = 1;
			}
	}

	static ArrayList<Integer>[] adjList;
	static int V, counter, SCC, dfs_num[], dfs_low[];
	static boolean[] inSCC;
	static Stack<Integer> stack;
	static int[] cost;
	static long ans;
	static long r;

	static void tarjanSCC() // O(V + E)
	{
		for (int i = 0; i < V; ++i)
			if (dfs_num[i] == 0)
				tarjanSCC(i);
	}

	static void tarjanSCC(int u) {
		dfs_num[u] = dfs_low[u] = ++counter;
		stack.push(u);

		for (int v : adjList[u]) {
			if (dfs_num[v] == 0)
				tarjanSCC(v);
			if (!inSCC[v])
				dfs_low[u] = Math.min(dfs_low[u], dfs_low[v]);
		}
		if (dfs_num[u] == dfs_low[u]) {
			// SCC found
			SCC++;
			int c = 0;
			int min = 1000000000;

			while (true) {
				int v = stack.pop();
				if (min > cost[v]) {
					c = 1;
					min = cost[v];
				} else if (min == cost[v])
					c++;
				inSCC[v] = true;
				if (v == u)
					break;
			}
			r = r + min;
			ans = (ans * 1l * c) % 1000000007;
		}
	}

	static ArrayList<Integer> arr;
	static int n;
	static int m;
	static int k1;
	static int k2;
	static long[][][][] memo;

	static long dp(int idx, int t, int c, int l) {
		if (idx == n + m) {
			return 1;
		}
		if (t == n) {
			if (n + m - idx > k2)
				return 0;
			else
				return 1;
		}
		if (idx - t == m) {
			if (n - t > k1)
				return 0;
			else
				return 1;
		}
		if (memo[idx][t][c][l] != -1)
			return memo[idx][t][c][l];
		long max = 0;
		if (l == 0) {
			if (c == k1)
				max += dp(idx + 1, t, 1, 1);
			else {
				max += (dp(idx + 1, t + 1, c + 1, l) + dp(idx + 1, t, 1, 1)) % 100000000;
			}
		} else {
			if (c == k2)
				max += dp(idx + 1, t + 1, 1, 0);
			else {
				max += (dp(idx + 1, t, c + 1, l) + dp(idx + 1, t + 1, 1, 0)) % 100000000;
			}
		}
		return memo[idx][t][c][l] = max;
	}

	static long[] cum;

	public static void main(String[] args) throws NumberFormatException, IOException, InterruptedException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());

		sieve(100000);
		int[] a = primeFactors(n);
		int[] b = primeFactors(m);
//		System.out.println(b[b.length - 1]);
		int d = Math.max(a[2], b[2]) - Math.min(a[2], b[2]) + Math.max(a[3], b[3]) - Math.min(a[3], b[3])
				+ Math.max(a[5], b[5]) - Math.min(a[5], b[5]);
		boolean f = true;
		for (int i = 7; i < 100000 && f; i++)
			if (a[i] != b[i])
				f = false;
		if (f)
			pw.println(d);
		else
			pw.println(-1);
		pw.flush();
		pw.close();

	}

	static long dis(int x, int y, int z, int w) {
		return (x - z) * (x - z) + (y - w) * (y - w);
	}

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

	static class pair implements Comparable<pair> {
		int x;
		int y;

		public pair(int d, int u) {
			x = d;
			y = u;
		}

		@Override
		public int compareTo(pair o) {
			// TODO Auto-generated method stub
			if (x == o.x)
				return y - o.y;
			return x - o.x;
		}

	}

	static class triple implements Comparable<triple> {
		int x;
		int y;
		int z;

		public triple(int a, int b, int c) {
			x = a;
			y = b;
			z = c;
		}

		@Override
		public int compareTo(triple o) {
			// TODO Auto-generated method stub
			return y - o.y;
		}
	}
}
