#include <stdio.h>

char prime[1000000];

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

	prime[0] = prime[1] = 1;
	for (i = 4; i < 1000000; i += 2) prime[i] = 1;
	for (i = 3; i <= 1000; i += 2){
		if (prime[i]) continue;
		for (j = i * i; j < 1000000; j += i) prime[j] = 1;
	}

	while (scanf("%d %d %d", &a, &d, &n), n){
		for (i = 0; n; i++) n -= !prime[a + d * i];
		printf("%d\n", a + d * i - d);
	}

	return 0;
}