def prime_check x
    prime = true
    2.upto(Math.sqrt(x)){|i|
        if x % i == 0
            prime = false
            break
        end
    }
    return prime
end

while true
    a, d, n = gets.chomp.split.map(&:to_i)
    break if [a, d, n] == [0, 0, 0]
    primes, x = [], a - d
    while primes.length < n
        x += d
        primes << x if x != 1 && prime_check(x)
    end
    puts primes.last
end
