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


public class Main {
    static PrintWriter out=new PrintWriter(System.out);
    static long n,m,a,b;

    public static void main(String[] args) throws IOException {
        //BufferedReader reader=new BufferedReader(new FileReader("input.txt"));
        //PrintWriter pw=new PrintWriter(new BufferedWriter(new FileWriter("output.txt")));
        //BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        //Scanner scanner=new Scanner(System.in);
        Reader in = new Reader();

        int a=in.nextInt();
        int b=in.nextInt();
        int[] d={2,3,5};
        int aCount=0,bCount=0;
        int[] ac=new int[3];
        int[] bc=new int[3];
        while (a!=b && (ok(a) || ok(b))){
            for (int i = 0; i <3 ; i++) {
                if (a%d[i]==0 || b%d[i]==0){
                    if (a%d[i]==0){
                        a/=d[i];
                        ac[i]++;
                    }
                    if (b%d[i]==0){
                        b/=d[i];
                        bc[i]++;
                    }
                }
            }
        }
        if (a==b)
            System.out.println(Math.abs(ac[0]-bc[0])+Math.abs(ac[1]-bc[1])+Math.abs(ac[2]-bc[2]));
        else
            System.out.println(-1);



















        out.close();

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

    }
    static boolean ok(int n){
        if (n%2==0 || n%3==0 || n%5==0)
            return true;
        else
            return false;
    }




    static int find(int n,int[] p){
        if (p[n]==n)return n;
        return p[n]=find(p[n],p);
    }
    static void union(int a,int b,int[] p){
        int aRoot=find(a,p);
        int bRoot=find(b,p);
        if (aRoot==bRoot)return;
        p[bRoot]=aRoot;
        //level[aRoot]+=level[bRoot];
    }
}
class node implements Comparable<node>{
    Integer no;
    Integer cost;
    Vector<node> adj=new Vector<>();
    public node(Integer no, Integer cost) {
        this.no = no;
        this.cost = cost;
    }

    @Override
    public String toString() {
        return "node{" +
                "no=" + no +
                ", cost=" + cost +
                '}';
    }

    @Override
    public int compareTo(node o) {
        return o.cost-this.cost;
    }
}
class edge implements Comparable<edge>{
    tuple u;
    Double cost;
    public edge(tuple u, Double cost) {
        this.u = u;
        this.cost = cost;
    }
    @Override
    public int compareTo(edge o) {
        return this.cost.compareTo(o.cost);
    }

    @Override
    public String toString() {
        return "edge{" +
                "u=" + u +
                ", cost=" + cost +
                '}';
    }
}
///*
class tuple implements Comparable<tuple>{
    int a;
    int b;
    tuple(int a, int b) {
        this.a = a;
        this.b = b;
    }

    @Override
    public int compareTo(tuple o) {
        return (this.a-o.a);
    }

    @Override
    public String toString() {
        return "tuple{" +
                "a=" + a +
                ", b=" + b +
                '}';
    }
}

//*/
class Reader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader() {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public Reader(String file_name) throws IOException {
        din = new DataInputStream(new FileInputStream(file_name));
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException {
        byte[] buf = new byte[64];
        int cnt = 0, c;
        while ((c = read()) != -1) {
            if (c == '\n') break;
            buf[cnt++] = (byte) c;
        }
        return new String(buf, 0, cnt);
    }

    public int nextInt() throws IOException {
        int ret = 0;
        byte c = read();
        while (c <= ' ') c = read();
        boolean neg = (c == '-');
        if (neg) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        if (neg) return -ret;
        return ret;
    }

    public long nextLong() throws IOException {
        long ret = 0;
        byte c = read();
        while (c <= ' ') c = read();
        boolean neg = (c == '-');
        if (neg) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        if (neg) return -ret;
        return ret;
    }

    public double nextDouble() throws IOException {
        double ret = 0, div = 1;
        byte c = read();
        while (c <= ' ') c = read();
        boolean neg = (c == '-');
        if (neg) c = read();
        do {
            ret = ret * 10 + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        if (c == '.') while ((c = read()) >= '0' && c <= '9') ret += (c - '0') / (div *= 10);
        if (neg) return -ret;
        return ret;
    }

    private void fillBuffer() throws IOException {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if (bytesRead == -1) buffer[0] = -1;
    }

    private byte read() throws IOException {
        if (bufferPointer == bytesRead) fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException {
        if (din == null) return;
        din.close();
    }
}