inputs = STDIN.readlines.map{|line|line.strip.split()}
line = inputs.shift

a = line[0].to_i
b = line[1].to_i
k = line[2].to_i

100.times do |t|
    n = 100 - t
    if a % n == 0 && b % n == 0 then
        k -= 1
        if k == 0 then
            puts(n)
            break
        end
    end
end
