A, B = gets.split.map(&:to_i) ans = (A+B).gcd(A*B) puts ans