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
# python2
import sys
import os.path
import operator
from heapq import heapify, heappush, heappop
from sets import Set
from collections import deque


TWs1=dict()
THs1=dict()
FIs1=dict()
TWs2=dict()
THs2=dict()
FIs2=dict()
nums2 = Set()
nums3 = Set()
nums5 = Set()

def sol1(n,type,counter):
    if n == 1 or n in nums2 or n in nums3 or n in nums5:
        return

    if type==2:
        nums2.add(n)
        if n%2==0:
            TWs1[n/2] = counter
            sol1(n/2,2,counter+1)
        if n%3==0:
            TWs1[n/3] = counter
            sol1(n/3,2,counter+1)
        if n%5==0:
            TWs1[n/5] = counter
            sol1(n/5,2,counter+1)
    elif type==3:
        nums3.add(n)
        if n%2==0:
            THs1[n/2] = counter
            sol1(n/2,3,counter+1)
        if n%3==0:
            THs1[n/3] = counter
            sol1(n/3,3,counter+1)
        if n%5==0:
            THs1[n/5] = counter
            sol1(n/5,3,counter+1)
    elif type==5:
        nums5.add(n)
        if n%2==0:
            FIs1[n/2] = counter
            sol1(n/2,5,counter+1)
        if n%3==0:
            FIs1[n/3] = counter
            sol1(n/3,5,counter+1)
        if n%5==0:
            FIs1[n/5] = counter
            sol1(n/5,5,counter+1)

def sol2(n,type,counter):
    if n == 1 or n in nums2 or n in nums3 or n in nums5:
        return

    if type==2:
        nums2.add(n)
        if n%2==0:
            TWs2[n/2] = counter
            sol2(n/2,2,counter+1)
        if n%3==0:
            TWs2[n/3] = counter
            sol2(n/3,2,counter+1)
        if n%5==0:
            TWs2[n/5] = counter
            sol2(n/5,2,counter+1)
    elif type==3:
        nums3.add(n)
        if n%2==0:
            THs2[n/2] = counter
            sol2(n/2,3,counter+1)
        if n%3==0:
            THs2[n/3] = counter
            sol2(n/3,3,counter+1)
        if n%5==0:
            THs2[n/5] = counter
            sol2(n/5,3,counter+1)
    elif type==5:
        nums5.add(n)
        if n%2==0:
            FIs2[n/2] = counter
            sol2(n/2,5,counter+1)
        if n%3==0:
            FIs2[n/3] = counter
            sol2(n/3,5,counter+1)
        if n%5==0:
            FIs2[n/5] = counter
            sol2(n/5,5,counter+1)
def main():
    if os.path.exists('input.txt'):
        input = open('input.txt', 'r')
    else:
        input = sys.stdin
    #--------------------------------INPUT---------------------------------
    n,m = list(map(int, input.readline().split()))
    TWs1[n]=0
    TWs2[m]=0
    if n%2==0:
        sol1(n,2,1)
        nums2.clear()
        nums3.clear()
        nums5.clear()
    if n%3==0:
        sol1(n,3,1)
        nums2.clear()
        nums3.clear()
        nums5.clear()
    if n%5==0:
        sol1(n,5,1)
        nums2.clear()
        nums3.clear()
        nums5.clear()

    if m%2==0:
        sol2(m,2,1)
        nums2.clear()
        nums3.clear()
        nums5.clear()
    if m%3==0:
        sol2(m,3,1)
        nums2.clear()
        nums3.clear()
        nums5.clear()
    if m%5==0:
        sol2(m,5,1)
        nums2.clear()
        nums3.clear()
        nums5.clear()
    '''
    print TWs1
    print THs1
    print FIs1
    print
    print TWs2
    print THs2
    print FIs2
    '''
    minone = 1000000001
    for key, value in TWs1.items():
        res = 1000000001
        if key in TWs2:
            res = min(res,value+TWs2[key])
        if key in THs2:
            res = min(res,value+THs2[key])
        if key in FIs2:
            res = min(res,value+FIs2[key])
        minone = min(minone,res)
    for key, value in THs1.items():
        res = 1000000001
        if key in TWs2:
            res = min(res,value+TWs2[key])
        if key in THs2:
            res = min(res,value+THs2[key])
        if key in FIs2:
            res = min(res,value+FIs2[key])
        minone = min(minone,res)
    for key, value in FIs1.items():
        res = 1000000001
        if key in TWs2:
            res = min(res,value+TWs2[key])
        if key in THs2:
            res = min(res,value+THs2[key])
        if key in FIs2:
            res = min(res,value+FIs2[key])
        minone = min(minone,res)
    #print minone
    if minone==1000000001:
        output = -1
    else:
        output = minone
    #-------------------------------OUTPUT----------------------------------
    if os.path.exists('output.txt'):
        open('output.txt', 'w').writelines(str(output))
    else:
        sys.stdout.write(str(output))


if __name__ == "__main__":
    main()

