#include <stdio.h>

int isPrime( int );

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

	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;
}

int isPrime( int n ) {
	int i;

	if ( n == 1 )
		return 0;

	for ( i = 2; i * i <= n; i++ )
		if ( n % i == 0 )
			break;
	if ( i * i > n )
		return 1;

	return 0;
}