#include <stdio.h>
#define DIGIT 1000000

int prime[DIGIT];

void eratosthenes(void) {
    int i, j;
    prime[1] = 1;
    for(i = 2; i * i < DIGIT + 1; i++ ) {
        for(j = i; j * i < DIGIT; j++ ) {
            prime[i * j] = 1;
        }
    }
}

int main(void) {
    int a, d, n, i, count, num;
    eratosthenes();
    while(scanf("%d %d %d",&a, &d, &n), a != 0) {
        for(count = 0, num = a; ;num += d) {
            if(!prime[num]) { 
                count++;
            }
            if(count == n) {
                break;
            }
        }
        printf("%d\n",num);
    }
    return 0;
}