#include <stdio.h>

#define MAX_PRIME	(1000000)


int prime[MAX_PRIME + 1];

void make_prime(void)
{
    int i;
    int j;
    int n;
    int c;
    
    for (i = 2; i * i <= MAX_PRIME; i++){
        if (prime[i] == 0){
            for (j = i * 2; j <= MAX_PRIME; j += i){
				prime[j] = 1;
            }
        }
    }
}
	


int main(void)
{
	int a, d, n;
    int i;
	int count;
	
	make_prime();

    while (1){
		scanf("%d%d%d", &a, &d, &n);
		
		count = 0;
		i = a;
		if (i == 1){
			i += d;
		}
		while (i <= MAX_PRIME){
			if (prime[i] == 0){
				count++;
				if (count == n){
					printf("%d\n", i);
					break;
				}
			}
			i += d;
		}
    }
    
    return (0);
}