from math import gcd a, b = map(int, input().split()) ans = gcd(a + b, a * b) print(ans)