import math A, B = map(int, input().split()) ans = math.gcd(A + B, A * B) print(ans)