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

while !judge do
  sum = a + (d*i)

  primejudge = true

  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