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