from sys import stdin input = stdin.readline a, b = map(int, input().split()) n = 1 while True: if n % a == n % b: break else: n += 1 print(n)