import math A = [int(i) for i in input().split()] print(math.gcd(A[0]+A[1],A[0]*A[1]))