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

def inshi(n)
    inshi = []
    max_so = Math.sqrt(n).to_i
    so = []
    for i in 1..n
        if i == 0 || i == 1
        elsif i == 2
            so.push(2)
        else
            flg = 1
            for j in 2..Math.sqrt(i).to_i
                if i % j == 0
                   flg = 0
                   break
                end
            end
            if flg == 1
                so.push(i)
            end
        end
    end

    i = 0
    while true
        if n % so[i] == 0
           inshi.push(so[i])
           n = n/so[i]
        else
           i += 1
        end
        if n < so[i]
           break
        end
    end

    return inshi
end


inshi_a = inshi(a)
inshi_b = inshi(b)
sosu = inshi_a + inshi_b
sosu.uniq!
puts(sosu.inject(:*))