a,b = gets.split.map(&:to_i)

def gcd(a,b)
  if b!=0 then
    return gcd(b, a%b)
  else
    return a
  end
end

puts gcd(a+b, a*b)