def gcd(a, b): if a == 0: return b else: return gcd(b%a, a) A, B = map(int, input().split()) S = A+B P = A*B ans = gcd(S, P) print(ans)