import fractions def F(n): while n%2==0:n//=2 while n%5==0:n//=5 return n == 1 n,m=int(input()),int(input()) if F(fractions.Fraction(n,m).denominator): for x in str(format(n/m,'.14f'))[::-1]: if x not in['0','.'] :print(x);break else:print(-1)