def f(x): a = 0 while x % 2 == 0: a += 1 x //= 2 b = 0 while x % 5 == 0: b += 1 x //= 5 return a, b def ask(a, b, fin=False): x = 1 for _ in range(a): x *= 2 for _ in range(b): x *= 5 print(x, flush=True) if fin: exit() return f(int(input())) x1, x2 = map(int, input().split()) a1, b1 = f(x1) a2, b2 = f(x2) while a1 != 7 or b1 != 9: if abs(a1 - a2) + abs(b1 - b2) <= 1: ask(a2, b2, True) exit() if a1 < 7: a1 += 1 elif a1 > 7: a1 -= 1 else: b1 += 1 a2, b2 = ask(a1, b1) if a1 == a2 and b1 == b2: exit() d = abs(a1 - a2) + abs(b1 - b2) if d == 1: ask(a2, b2, True) exit() if d % 2 == 0: a1 = 9 a2, b2 = ask(a1, b1) while 1: if abs(a1 - a2) + abs(b1 - b2) <= 1: ask(a2, b2, True) exit() da = abs(a1 - a2) db = abs(b1 - b2) if da > db: if a1 > a2: a1 -= 1 else: a1 += 1 else: if b1 > b2: b1 -= 1 else: b1 += 1 a2, b2 = ask(a1, b1) if a1 == a2 and b1 == b2: exit()