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
#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
int parent(int i, vector<long long> &a) {
  if (a[i] == i) return i;
  return parent(a[i], a);
}
void make_par(vector<long long> &a, int x, int y) {
  int para = parent(x, a);
  int parb = parent(y, a);
  a[parb] = para;
}
long long jjjj(long long j) {
  long long c = 0;
  while (j != 0) {
    j /= 2;
    ++c;
  }
  return c;
}
long long maxi(long long a, long long b) { return (a > b) ? a : b; }
int rminutil(vector<long long> &a, int si, int sj, int i, int j, int k) {
  if (si >= i && sj <= j) {
    return a[k];
  }
  if (sj < i || si > j) {
    return INT_MAX;
  }
  int mid = si + (sj - si) / 2;
  return min(rminutil(a, si, mid, i, j, 2 * k),
             rminutil(a, mid + 1, sj, i, j, 2 * k + 1));
}
int rmin(vector<long long> &a, int n, int i, int j) {
  if (i < 0 || j > n - 1 || i > j) {
    cout << "invalid";
    return -1;
  }
  return rminutil(a, 0, n - 1, i, j, 1);
}
void RMQ(vector<long long> &a, int b[], int i, int j, int n, int k) {
  if (i == j) {
    a[k] = b[i];
  }
  int mid = i + (j - i) / 2;
  if (a[k] == -1) {
    if (a[2 * k] == -1) {
      RMQ(a, b, i, mid, n, 2 * k);
    }
    if (a[2 * k + 1] == -1) {
      RMQ(a, b, mid + 1, j, n, 2 * k + 1);
    }
    a[k] = min(a[2 * k], a[2 * k + 1]);
  }
}
void minupdate(vector<long long> &a, int si, int sj, int i, int old, int ne,
               int k) {
  if (i < si || i > sj) {
    return;
  }
  if (si == sj) {
    a[k] = ne;
  }
  if (si != sj) {
    int mid = si + (sj - si) / 2;
    if (i <= mid) {
      minupdate(a, si, mid, i, old, ne, 2 * k);
    } else {
      minupdate(a, mid + 1, sj, i, old, ne, 2 * k + 1);
    }
    a[k] = min(a[2 * k], a[2 * k + 1]);
  }
}
void sumupdate(vector<long long> &a, int si, int sj, int i, int old, int ne,
               int k) {
  if (i < si || i > sj) {
    return;
  }
  a[k] = a[k] + ne - old;
  if (si != sj) {
    int mid = si + (sj - si) / 2;
    sumupdate(a, si, mid, i, old, ne, 2 * k);
    sumupdate(a, mid + 1, sj, i, old, ne, 2 * k + 1);
  }
}
long long rsumutil(vector<long long> &a, int si, int sj, int i, int j, int k) {
  if (si >= i && sj <= j) {
    return a[k];
  }
  if (sj < i || si > j) {
    return 0;
  }
  int mid = si + (sj - si) / 2;
  return rsumutil(a, si, mid, i, min(j, mid), 2 * k) +
         rsumutil(a, mid + 1, sj, max(i, mid + 1), j, 2 * k + 1);
}
long long rsum(vector<long long> &a, int n, int i, int j) {
  if (i < 0 || j >= n || i > j) {
    cout << "invalid";
    return -1;
  }
  return rsumutil(a, 0, n - 1, i, j, 1);
}
void RSQ(vector<long long> &a, int b[], int i, int j, int n, int k) {
  if (i == j) {
    a[k] = b[i];
  }
  int mid = i + (j - i) / 2;
  if (a[k] == -1) {
    if (a[2 * k] == -1) {
      RSQ(a, b, i, mid, n, 2 * k);
    }
    if (a[2 * k + 1] == -1) {
      RSQ(a, b, mid + 1, j, n, 2 * k + 1);
    }
    a[k] = a[2 * k] + a[2 * k + 1];
  }
}
long long binaryexp(long long a, long long b, long long i) {
  if (b == 0) return 1LL;
  if (b == 1) return a;
  long long k = binaryexp(a, b / 2, i);
  if (b & 1) {
    return (((k * k) % i) * a) % i;
  } else
    return (k * k) % i;
}
long long mini(long long a, long long b) { return (a < b) ? a : b; }
void diff(int a[], int h, vector<long long> &v) {
  if (h == 0) {
    v[0] = a[0];
    v[1] += a[0];
  }
  diff(a, h - 1, v);
}
bool prime(long long n) {
  int c = 0;
  int k = sqrt(n);
  for (long long i = 1; i < sqrt(n); i++) {
    if (n % i == 0) ++c;
  }
  if (k * k == n) {
    ++c;
  }
  return c == 2;
}
int main() {
  int t;
  t = 1;
  while (t--) {
    long long a, b;
    cin >> a >> b;
    long long k;
    k = 0;
    int va[6];
    int vb[6];
    memset(va, 0, sizeof va);
    memset(vb, 0, sizeof vb);
    while (a % 3 == 0) {
      a /= 3;
      ++k;
    }
    va[3] = k;
    k = 0;
    while (a % 5 == 0) {
      a /= 5;
      ++k;
    }
    va[5] = k;
    k = 0;
    while (a % 2 == 0) {
      a /= 2;
      ++k;
    }
    va[2] = k;
    k = 0;
    while (b % 2 == 0) {
      b /= 2;
      ++k;
    }
    vb[2] = k;
    k = 0;
    while (b % 3 == 0) {
      b /= 3;
      ++k;
    }
    vb[3] = k;
    k = 0;
    while (b % 5 == 0) {
      b /= 5;
      ++k;
    }
    vb[5] = k;
    if (b != a) {
      cout << -1;
    } else {
      cout << maxi(va[2], vb[2]) - mini(va[2], vb[2]) + maxi(va[3], vb[3]) -
                  mini(va[3], vb[3]) + maxi(va[5], vb[5]) - mini(va[5], vb[5]);
    }
  }
}
