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
919536000 993098880
 691200 583200
 5 1000000000
 100 10
 537814642 537814642
 21 35
 800000 729000
 881280 765000
 864000000 607500000
 648293430 540244525
 445906944 528482304
 820125000 874800000
 509607936 306110016
 792000 792000
 513600 513600
 1000000000 1
 673067520 807681024
 1 1
 7920 9900
 689147136 861433920
 1024 1048576
 36 30
 119144448 423624704
 576000 972000
 1000000000 7
 1 22
 609120000 913680000
 720212000 864254400
 21751200 43502400
 900000011 800000011
 607500 506250
 1024 729
 3303936 3097440
 1 1000000000
 19500000 140400000
 847500 610200
 536870912 387420489
 100000007 800000011
 1000000000 3
 900000011 999900017
 2208870 122715
 1000000000 2
 1000000000 5
 10332160 476643528
 1 1024
 3 1000000000
 9900 7128
 4812500 7577955
 55404 147744
 522784320 784176480
 2 1000000000

5
 8
 17
 2
 0
 2
 13
 9
 9
 3
 8
 6
 24
 0
 0
 18
 3
 0
 3
 3
 10
 3
 7
 7
 -1
 -1
 2
 3
 1
 -1
 3
 16
 6
 18
 5
 5
 47
 -1
 19
 -1
 3
 17
 17
 19
 10
 19
 5
 16
 4
 2
 17

#include <bits/stdc++.h>
using namespace std;
const long long MAX = 9999999;
const long long modu = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, m;
  cin >> n >> m;
  long long i, j, k;
  i = j = k = 0;
  while (n % 2 == 0) {
    n /= 2;
    i++;
  }
  while (n % 3 == 0) {
    n /= 3;
    j++;
  }
  while (n % 5 == 0) {
    n /= 5;
    k++;
  }
  long long i1, j1, k1;
  i1 = j1 = k1 = 0;
  while (m % 2 == 0) {
    m /= 2;
    i1++;
  }
  while (m % 3 == 0) {
    m /= 3;
    j1++;
  }
  while (m % 5 == 0) {
    m /= 5;
    k1++;
  }
  if (n != m)
    cout << -1;
  else {
    long long ans = abs(i - i1) + abs(j - j1) + abs(k - k1);
    cout << ans;
  }
}
