#include #include using namespace std; int main() { unsigned long long n, m; while (cin>>n>>m) { auto g=__gcd(n, m); n/=g, m/=g; int c2=0, c5=0; while (m>0 and m%2==0) { m/=2; ++c2; } while (m>0 and m%5==0) { m/=5; ++c5; } if (m>1) cout<<-1<0 and n%10==0) n/=10; cout<