#include<stdio.h>
#define MAX 1000000

int main(void){
  int i,c;
  int a,d,n;
  char p[MAX];
	
  p[0]=0;
  p[1]=0;                       //1ÍfÅÈ¢
  p[2]=1;                       //2ÍfÅ é
  for(i=3;i<MAX;i+=2)p[i]=1;    //ïÍfÌÂ\«ª é
  for(i=4;i<MAX;i+=2)p[i]=0;    //ôÍfÌÂ\«ªÈ¢

  c = 3;  
  while(1){
    for(i=2*c;i<MAX;i+=c)p[i] = 0;   //©gÌ{ÌcheckðÍ¸·
    while(!p[++c]);                    //
    if(c>1000)break;
  }
  
  while(1){
    scanf("%d %d %d ",&a,&d,&n);
    if(!a && !d && !n)break;
    c = 0;
    i = 0;
    while(1){
      if(p[a+i*d])c++;
      if(n==c){
	printf("%d\n",a+i*d);
	break;
      }
      i++;
    }
  }
  return 0;
}