#include typedef long long ll; typedef unsigned long long ull; #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define RANGE(vec) (vec).begin(),(vec).end() using namespace std; template T gcd(T a, T b) { if ( a < b ) std::swap(a,b); if ( b == 0 ) return a; return gcd(b, a%b); } class FiniteDecimal { public: void solve(void) { ll N,M; cin>>N>>M; ll g = gcd(N,M); // 互いに素にしておく N /= g; M /= g; if (N % M == 0) { ll x = N/M; while (x%10 == 0) x /= 10; cout<solve(); delete obj; return 0; } #endif