from decimal import * getcontext().prec = 1100000 N = Decimal(input()) M = Decimal(input()) x = N / M s = str(x) if(len(s)>100000): print(-1) else: for i in range(len(s)): if s[i] == 'E': s = s[:i] break for i in reversed(range(len(s))): if s[i]!='0' and s[i]!='.': print(s[i]) break