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.io.*;
import java.math.BigDecimal;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Queue;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.logging.SimpleFormatter;


public class Main1 {




    public static void main(String[] args) {


        try {


            FastScanner in = new FastScanner();
            PrintWriter out = new PrintWriter(System.out);


             int A[] = new int[6] ;
             int B[] = new int[6] ;
             int a = in.nextInt() ;
             int b = in.nextInt() ;
             int AA = a ;
             int BB = b ;

            while (a%2 == 0){
                a /= 2 ;
                A[2]++ ;
            }
            while (a%3 == 0){
                a /= 3 ;
                A[3]++ ;
            }
            while (a % 5 == 0) {
                a /= 5 ;
                A[5]++ ;
            }


            while (b%2 == 0){
                b /= 2 ;
                B[2]++ ;
            }
            while (b%3 == 0){
                b /= 3 ;
                B[3]++ ;
            }
            while (b % 5 == 0) {
                b /= 5 ;
                B[5]++ ;
            }
            int tt = 0 ;
            a = AA ;
            b = BB ;


            if (A[2] != B[2]){
               int to_inc = Math.abs(A[2] - B[2]) ;
               tt += to_inc ;
               if (A[2] > B[2]) {
                   while (to_inc-- > 0)
                       a/= 2;
               }
               else {
                   while (to_inc-- > 0)
                       b /=2 ;
               }

            }
            if (A[3] != B[3]){
                int to_inc = Math.abs(A[3] - B[3]) ;
                tt += to_inc ;
                if (A[3] > B[3]) {
                    while (to_inc-- > 0)
                        a/= 3;
                }
                else {
                    while (to_inc-- > 0)
                        b /=3 ;
                }

            }


            if (A[5] != B[5]){
                int to_inc = Math.abs(A[5] - B[5]) ;
                tt += to_inc ;
                if (A[5] > B[5]) {
                    while (to_inc-- > 0)
                        a/= 5;
                }
                else {
                    while (to_inc-- > 0)
                        b /=5 ;
                }

            }


            if (a != b)
                System.out.println(-1);
            else
                System.out.println(tt);






















            out.flush();
            out.close();
        }
        catch (Exception e){
            return;
        }

    }

    static int findLCA(int a, int b, int par[][], int depth[]) {
        if (depth[a] > depth[b]) {
            a = a ^ b;
            b = a ^ b;
            a = a ^ b;
        }
        int diff = depth[b] - depth[a];
        for (int i = 19; i >= 0; i--) {
            if ((diff & (1 << i)) > 0) {
                b = par[b][i];
            }
        }
        if (a == b)
            return a;
        for (int i = 19; i >= 0; i--) {
            if (par[b][i] != par[a][i]) {
                b = par[b][i];
                a = par[a][i];
            }
        }
        return par[a][0];
    }

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

    static void formArrayForBinaryLifting(int n, int par[][]) {
        for (int j = 1; j < 20; j++) {
            for (int i = 0; i < n; i++) {
                if (par[i][j - 1] == -1)
                    continue;
                par[i][j] = par[par[i][j - 1]][j - 1];
            }
        }
    }


    static void sort(int ar[]) {
        int n = ar.length;
        ArrayList<Integer> a = new ArrayList<>();
        for (int i = 0; i < n; i++)
            a.add(ar[i]);
        Collections.sort(a);
        for (int i = 0; i < n; i++)
            ar[i] = a.get(i);
    }

    static void sort1(long ar[]) {
        int n = ar.length;
        ArrayList<Long> a = new ArrayList<>();
        for (int i = 0; i < n; i++)
            a.add(ar[i]);
        Collections.sort(a);
        for (int i = 0; i < n; i++)
            ar[i] = a.get(i);
    }

    static long ncr(long n, long r, long mod) {
        if (r == 0)
            return 1;
        long val = ncr(n - 1, r - 1, mod);
        val = (n * val) % mod;
        val = (val * modInverse(r, mod)) % mod;
        return val;
    }

    static long fast_pow(long base, long n, long M) {
        if (n == 0)
            return 1;
        if (n == 1)
            return base % M;
        long halfn = fast_pow(base, n / 2, M);
        if (n % 2 == 0)
            return (halfn * halfn) % M;
        else
            return (((halfn * halfn) % M) * base) % M;
    }

    static long modInverse(long n, long M) {
        return fast_pow(n, M - 2, M);
    }


    private static int countDigits(long l) {
        if (l >= 1000000000000000000L) return 19;
        if (l >= 100000000000000000L) return 18;
        if (l >= 10000000000000000L) return 17;
        if (l >= 1000000000000000L) return 16;
        if (l >= 100000000000000L) return 15;
        if (l >= 10000000000000L) return 14;
        if (l >= 1000000000000L) return 13;
        if (l >= 100000000000L) return 12;
        if (l >= 10000000000L) return 11;
        if (l >= 1000000000L) return 10;
        if (l >= 100000000L) return 9;
        if (l >= 10000000L) return 8;
        if (l >= 1000000L) return 7;
        if (l >= 100000L) return 6;
        if (l >= 10000L) return 5;
        if (l >= 1000L) return 4;
        if (l >= 100L) return 3;
        if (l >= 10L) return 2;
        return 1;
    }


    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private static final int THRESHOLD = 32 << 10;
        private final Writer os;
        private StringBuilder cache = new StringBuilder(THRESHOLD * 2);

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        private void afterWrite() {
            if (cache.length() < THRESHOLD) {
                return;
            }
            flush();
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput append(long c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput append(String c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput println() {
            return append(System.lineSeparator());
        }

        public FastOutput flush() {
            try {
                //            boolean success = false;
                //            if (stringBuilderValueField != null) {
                //                try {
                //                    char[] value = (char[]) stringBuilderValueField.get(cache);
                //                    os.write(value, 0, cache.length());
                //                    success = true;
                //                } catch (Exception e) {
                //                }
                //            }
                //            if (!success) {
                os.append(cache);
                //            }
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }


    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

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

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }


        long nextLong() {
            return Long.parseLong(next());
        }
    }


}







