require 'mathn'
require 'prime'
d = gets.split.map(&:to_i).inject(:/).denominator
pfactors = []
Prime.each(Math.sqrt(d)) do |q|
    if d % q == 0
        pfactors << q
        d /= q while d % q == 0
    end
end
pfactors << d if d > 1
p pfactors.inject(:*)
