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