def gcd(a, b) r = a % b if r.zero? then return b end gcd(b, r) end A,B=gets.split.map(&:to_i) a = A + B b = A * B ans = gcd(a, b) print ans