require 'prime'
gets
A = gets.split(' ').map(&:to_i)

prime_divisions = A.map(&Prime.method(:prime_division))
primes = prime_divisions.map(&:transpose).map(&:first)

primes2 = primes.flatten.uniq.map { |n|
  [n, primes.count { |a| a.include?(n) }]
}.select { |_, count| count >= primes.size-1 }.map(&:first)

puts primes2.map { |prime|
  prime ** prime_divisions.flatten(1).select { |pri, *| pri == prime }.map { |_, n| n }.min
}.reduce(&:*)