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