#include <stdio.h>

int isPrime(int x) {
  int i;
  if (x == 1) return 0;
  if (x == 2) return 1;
  if (x == 3) return 1;
  if (x % 2 == 0) return 0;
  for (i = 3; i * i <= x; i += 2)
    if (x % i == 0) return 0;
  return 1;
}

int main(void) {
  int a, d, n, c;

  while (1) {
    scanf("%d %d %d", &a, &d, &n);
    if (a == 0 && d == 0 && n == 0) break;

    c = 0;
    while (1) {
      if(isPrime(a)) c++;
      if (c == n) break;
      a += d;
    }

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