#include <stdio.h>
#include <math.h>


int is_prime(int x)
{
    int square = sqrt(x);
    int i, j;

    if(x == 2)
        return 1;

    if(x < 2 || x % 2 == 0)
        return 0;

    for(i = 3; i <= square; i += 2){
        if(x % i == 0)
            return 0;
    }

    return 1;
}

int main(void)
{
    int a, d, n;

    while(1){
        int prime_no = 0;
        int prime_now = 0;
        scanf("%d %d %d", &a, &d, &n);

        if(a == 0 && d == 0 && n == 0)
            break;

        while(prime_no != n){
            if(is_prime(a)){
                prime_now = a;
                prime_no++;
            }

            a += d;
        }

        printf("%d\n", prime_now);
    }

    return 0;
}