#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=l;i<r;i++)

#define PLIMIT 1000000
int prime[PLIMIT+10];
void makep(ll n){prime[0]=prime[1]=1;for(int i=2;i*i<=n;i++)if(!prime[i])for(int j=i*i;j<=n;j+=i)prime[j]=1;}

int main(){
	makep(PLIMIT);
	ll a,d,n;
	while(scanf("%lld%lld%lld",&a,&d,&n),n){
		ll cnt=0;
		while(1){
			if(!prime[a]){
				cnt++;
				if(cnt==n){
					printf("%lld\n",a);
					break;
				}
			}
			a+=d;
		}
	}
}
