def isPrime(num)
  return false if num < 2
  return true if num == 2
  n = 2
  while n <= Math.sqrt(num) + 1
    return false if num % n == 0
    n += 1
  end
  return true
end

def compute(init, diff, num)
  found = 0
  n = init
  while true
    found += 1 if isPrime(n)
    if found == num
      puts n
      return
    end
    n += diff
  end
  
end

while line = gets.split(" ")
  a = line[0].to_i
  d = line[1].to_i
  n = line[2].to_i
  break if a == 0 and d == 0 and n == 0

  compute(a, d, n)
end