def gcd(a, b): if a < b: buf = a a = b b = buf ret = 1 while b != 0: ret = b b = a % b a = ret return ret A, B = map(int, raw_input().split()) print gcd(A + B, A * B)