def GCD(m, n): while True: k = m % n m = n n = k if k == 0: break return m A, B = [int(i) for i in input().split()] print(GCD(A + B, A * B))