require 'prime' A, B = gets.split.map(&:to_i) g = A.gcd(B) puts g * g.gcd(A / g + B / g)