#include <stdio.h>

#define MAX_N 1000000

int isPrime[ MAX_N + 1 ];

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

	isPrime[ 0 ] = isPrime[ 1 ] = 0;
	for ( i = 2; i <= MAX_N; i++ )
		isPrime[ i ] = 1;

	for ( i = 4; i <= n; i += 2 )
		isPrime[ i ] = 0;

	for ( i = 3; i * i <= n; i += 2 )
		if ( isPrime[ i ] )
			for ( j = i * 2; j <= n; j += i )
				isPrime[ j ] = 0;

	for ( ; scanf( "%d %d %d", &a, &d, &n ), a; printf( "%d\n", fig - d ) )
		for ( fig = a; n; fig += d )
			if ( isPrime[ fig ] )
				n--;

	return 0;
}