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

require 'prime'

def divisor(n)
  return [1] if n == 1
  Prime.prime_division(n).map do |e|
    Array.new(e[1]+1).map.with_index do |element, i|
      e[0]**i
    end
  end.inject{|p,q| p.product(q)}.map do |a|
    [a].flatten.inject(&:*)
  end.sort
end
a_a = divisor(a)
b_b = divisor(b)
ans = a_a & b_b
puts ans[k-1]