Fox Dividing Cheese

题意翻译

两头贪心的小熊有 a,b 两块蛋糕,他们都想要大的那一块的那一块。于是狡猾的狐狸提出一个方案:让狐狸吃掉一些蛋糕,最后使得两块蛋糕大小一样。假如这块蛋糕的重量是 2 的倍数,那么狐狸可以吃掉二分之一;假如蛋糕的重量是 3 的倍数,那么狐狸可以吃掉三分之二;假如蛋糕的重量是 5 的倍数,狐狸可以吃掉五分之四。为了不让狐狸吃掉太多,熊要求以最少的次数将两块蛋糕吃的大小一样,求最小次数。 输入输出格式 输入格式 第一行输入两个整数 $a,b$ ($1 \le a,b \le 10^9$)。 输出格式 若有可分方案,输出最小次数,若无可分方案,输出 `-1`。

题目描述

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.

输入输出格式

输入格式


The first line contains two space-separated integers $ a $ and $ b $ ( $ 1<=a,b<=10^{9} $ ).

输出格式


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.

输入输出样例

输入样例 #1

15 20

输出样例 #1

3

输入样例 #2

14 8

输出样例 #2

-1

输入样例 #3

6 6

输出样例 #3

0