line = gets.split(' ').map(&:to_i)

A = line[0]
B = line[1]
K = line[2]

num = 1
for i in 1..99 do
  if A % (100-i) == 0 and B % (100-i) == 0 then
    if num == K then
      puts 100 - i
      break
    else
      num += 1
    end
  end
end
