#include <stdio.h>
#include <string.h>
#define MAX 1000020

int p[MAX],size;
int flg[MAX];

int isPrime(int x){
	int i;
	for(i=0;p[i]*p[i]<=x;i++){
		if(x % p[i] == 0) return 0;
	}
	return 1;
}

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

	p[0] = 2;
	size = flg[2] = 1;
	flg[0] = flg[1] = 0;

	for(i=3;i<MAX;i++){
		if(isPrime(i)){
			p[size++] = i;
			flg[i] = 1;
		}
		else{
			flg[i] = 0;
		}
	}

	while(scanf("%d%d%d",&a,&d,&n) && (a||d||n)){
		while(1){
			if(flg[a]){
				n--;
				if(n == 0) break;
			}
			a += d;
		}

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

	return 0;
}