#include <iostream>
#include <algorithm>

#define P_MAX 1000*1000

using namespace std;

int main(){
	int a, d, n;
	static bool prime[P_MAX];
	fill(prime, prime+P_MAX, true);
	prime[0] = prime[1] = false;
	for(int i=2; i<P_MAX; i++){
		if(prime[i]) for(int j=i+i; j<P_MAX; j+=i) prime[j] = false;
	}

	while(1){
		cin >> a >> d >> n;
		if(!a && !d && !n) break;
		int count=0;
		for(int i=a; i<P_MAX; i+=d){
			if(prime[i]){
				if(++count==n){
					cout << i << endl;
					break;
				}
			}
		}
	}
	return 0;
}

