a,d,n = gets.split(" ")
a = a.to_i
d = d.to_i
n = n.to_i

i = 0
prime = 0
primeNum = 0
judge = false

unless a == 0 && d == 0 && n == 0
  while !judge do
    sum = a + (d*i)

    primejudge = true
    if sum == 1
      primejudge = false
    end

    for num in 2..(sum-1) do
      if sum % num == 0
        primejudge = false
        break
      end
    end

    if primejudge
      primeNum = primeNum + 1
      if primeNum == n
        prime = sum
        judge = true
        break
      end
    end
    i=i+1
  end
  puts prime
end