a, b, k = gets.split().map{|n| n.to_i}

a_list = []
a.times do |n|
    n += 1

    if a % n == 0
        a_list.push(n)
    end
end

b_list = []
b.times do |n|
    n += 1

    if b % n == 0
        b_list.push(n)
    end
end

ans_list = a_list & b_list

puts ans_list[-k]