#include <stdio.h>
#define MAX 1000000

int main(void){
  int p_num[MAX]={0};
  int a, d, n;
  int i, j;
  int count;

  while(1){
    scanf("%d %d %d", &a, &d, &n);
    
    if((a>9307 || d>346 || n>210) || (a==0 && d==0 && n==0))
      break;

    for(i=2;i<MAX;i++)
      p_num[i]=1;
    
    for(i=2;i*i<MAX;i++){
      if(p_num[i]){
	for(j=2*i;j<MAX;j+=i)
	  p_num[j]=0;
      }
    }

    count=0;

    for(i=a;count<=n;i+=d){
      if(p_num[i]==1)
	count++;
      if(n==count)
	break;
    }
    printf("%d\n",i);
  }

  return 0;
}