#include<stdio.h>
int judge(int);
int cont=0;
int main()
{
  int a,d,n,i,m=0;
  int an[1000];
  while(1){
    scanf("%d%d%d",&a,&d,&n);
    if(a==0 && d==0&&n==0)break;
    for(i=a;i<10000000;i+=d){
      cont+=judge(i);
      if(cont==n){
	an[m]=i;
        m++;
        break;
      }
    }
    cont=0;
  }
  for(i=0;i<m;i++){
    printf("%d\n",an[i]);
  }
  return 0;
}

int judge(int n)
{
  int i;
  if(n<2)return 0;
  else if(n==2)return 1;
  if(n%2==0)return 0;
  for(i=3;i<=n/i;i+=2){
    if(n%i==0)return 0;
  }
  return 1;
}