def gcd(x, y):
  if x < y:
    tmp = x
    x = y
    y = tmp
  while True:
    if y == 0:
      break
    x = x % y
    tmp = x
    x = y
    y = tmp

  return x

a,b = map(int, input().split())

c = gcd(a+b, a*b)
print(c)