import math def getlist(): return list(map(int, input().split())) A, B = getlist() GCD = math.gcd(A + B, A * B) print(GCD)