#include <stdio.h>

#define MAX (2000000)

char prime[MAX + 1];

int main(void)
{
	int i, j;
	int a, d, n;
	
	prime[0] = prime[1] = 0;
	for (i = 2; i <= MAX; i++){
		prime[i] = 1;
	}
	
	for (i = 2; i * i <= MAX; i++){
		for (j = i * i; j <= MAX; j += i){
			prime[j] = 0;
		}
	}
	
	while (1){
		scanf("%d %d %d", &a, &d, &n);
		
		if (!a && !d && !n){
			break;
		}
		
		i = 0;
		while (1){
			if (prime[a]){
				i++;
			}
			
			if (i == n){
				break;
			}
			
			a += d;
		}
		
		printf("%d\n", a);
	}
	
	return (0);
}