require 'prime'

A, B, K = gets.chomp.split.map(&:to_i)

a_div = A.prime_division
b_div = B.prime_division
a_div_h = Hash[*a_div.flatten]
b_div_h = Hash[*b_div.flatten]
primes = a_div.map{|t| t[0]} & b_div.map{|t| t[0]} # 積集合
c_div = primes.map{|p| [p, [a_div_h[p], b_div_h[p]].min]}
c_div_h = Hash[*c_div.flatten]

cds = [1]
for prime in primes do
  cds = cds.map{|e| (0..c_div_h[prime]).map{|power| prime**power}.map{|ee| ee*e}}.flatten
end

ans = cds.sort.reverse[K-1]
print("#{ans}\n")