# A B

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

def eratosthenes_sieve(n)
  check = Array.new(n, false)
  primes = []

  (2..n).each do |i|
    if !check[i]
      primes << i

      (i..n).step(i).each do |j|
        check[j] = true
      end
    end
  end

  primes
end

def prime_factorization(n)
  m = n
  result = []
  primes = eratosthenes_sieve(Math.sqrt(n).ceil)

  while true
    found = false

    primes.each do |pr|
      if m % pr == 0
        result << pr
        found = true
        m = m / pr
        break
      end
    end

    if !found
      result << m if m != 1
      break
    end
  end

  result
end

p_a = prime_factorization(a)
p_b = prime_factorization(b)

h_a = {}
h_b = {}

p_a.each do |i|
  h_a[i] ||= 0
  h_a[i] += 1
end

p_b.each do |i|
  h_b[i] ||= 0
  h_b[i] += 1
end

prod = 1

(h_a.keys + h_b.keys).uniq.each do |k|
  a = h_a[k] || 0
  b = h_b[k] || 0
  c = [a, b].max

  c.times do
    prod = prod * k
  end
end

puts prod
