x, y = [ int(v) for v in input().split() ] def gcd(a,b): if a < b: a, b = b, a while b >= 1: a, b = b, a % b return a print(gcd(x*y, x+y))