#pragma GCC optimize("Ofast") #include using namespace std; #ifdef __LOCAL #include #else #define debug(...) void(0) #endif #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() template istream& operator>>(istream&is,vector&v){ for(T&p:v)is>>p; return is; } template ostream& operator<<(ostream&os,const vector&v){ if(&os==&cerr)os<<"["; for(int i=0;i>n>>m; ll g=gcd(n,m); n/=g;m/=g; int tw=0,fi=0; while(m%2==0){ m/=2; tw++; } while(m%5==0){ m/=5; fi++; } if(m!=1){ cout<<-1<