#include<stdio.h>
#include<stdlib.h>
#include<math.h>
 
int Prime(int p){
  int i,f;
  f = 0;
  if(p == 1) return 0;
  if(p == 2) return 1;
  if(p % 2 == 0) return 0;
  for(i=3;i*i <= p;i += 2){
    if(p % i == 0) f = 1;
  }
 
  if(f == 0) return 1;
  else return 0;
}
int main() {
 
    int a,d,n;
    int i,count;
 
    while(1) {
        scanf("%d %d %d",&a,&d,&n);
        if(!a&&!d&&!n) break;
        count=0,i=a;
        while(count<n) {
            if(prime(i)) {
                count++;
            }
            i+=d;
            //printf("%d\n",i);
        }
        printf("%d\n",i-d);
    }
 
    return 0;
}