#include <stdio.h>

int main() {
  long a, d, n;
  long i, j;
  int pri[1000000] = {};
  pri[2] = 1;
  pri[3] = 1;

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

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

    do{
      if(pri[a] == 1){
        i++;
      }
      if(i < n)
        a += d;
    } while (i < n);

    printf("%ld\n", a);
  }
  return 0;
}