from fractions import gcd a, b = tuple(int(i) for i in input().split()) s = a + b p = a * b g = gcd(s, p) print(g)