A, B = map(int, input().split(" "))

p = A + B
m = A * B

while True:
    tmp = p
    p = m
    m = tmp % m
    if m == 0:
        break

print(p)