#include <stdio.h>

#define MAX_N 1000000

int isPrime[ MAX_N + 1 ] = { 0, 0, 1 };

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

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

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

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

	return 0;
}