def gcd(x,y):
	return x if y == 0 else gcd(y,x%y)
A,B = map(int,input().split())
S = A + B
P = A * B
print(gcd(S,P))