function main(input) {
  const args = input.split(' ');
  const A = args[0];
  const B = args[1];
  const K = args[2];
  const [min, max] = A < B ? [A, B] : [B, A];
  const result = Array.from(Array(min + 1), (v, i) => i).reduce((sum, cu) => {
    if (Number.isInteger(min / cu) && Number.isInteger(max / cu)) {
      return sum === K ? cu : sum++;
    }
  }, 0);
  console.log(result);
}