def gcd(a,b): if a < b: t = a a = b b = t if a % b == 0: return b else: return gcd(b,a%b) a,b = map(int, raw_input().split()) print gcd(a+b,a*b)