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