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

int judge_prime_number(int n);

int main(void) {
	while(1){
		int a,d,n;
		scanf("%d %d %d",&a,&d,&n);
		if(a==0 && d==0 && n==0){break;}
		int i,count,judge;
		i = 0;
		count = 0;
		while(1){
			judge = judge_prime_number(a + (d * i));
			if(judge == 1){
				count += 1;
				if(count == n){
					printf("%d\n",a+(d*i));
					break;
				}
			}
			i++;
		}
	}
	return 0;
}

int judge_prime_number(int n){
	if(n==2 || n==3 || n==5 || n==7 || n==11 || n==13){
		return 1;
	}
	if((n%2)==0 || (n%3)==0 || (n%5)==0 || (n%7)==0 || (n%11)==0 || n==1){
		return 0;
	}

	int root_n;
	root_n = (int)sqrt(n);
	int i;
	for(i=3;i<=root_n;i+=2){
		if((n % i)==0){return 0;}
	}
	return 1;

}