#include<stdio.h>
#include<math.h>

int main(void){
    int count2=0;
    int ans[100000]={0};
    while(1){
        int a=0;
        int d=0;
        int n=0;
        int sq=0;
        scanf("%d %d %d",&a,&d,&n);
        if(a==0&&d==0&&n==0) break;
        int sum=a;
        int count=0;
        int end=0;
        while(1){
            /* if(sum==2){
                count++;
                if(count==n){
                    ans[count2]=sum;
                    end=1;
                }
                }*/
            
            sq=sqrt(sum);
           
           
            for(int i=2;i<=sq+1;i++){
                if(i==sq+1&&sum!=1){
                    count++;
                   
                    if(count==n){
                        ans[count2]=sum;
                        end=1;
                    }
                    break;
                }
                if(sum%i==0) break;
            }
            if(end==1) break;
            sum+=d;
        }
        count2++;
    }
    
    for(int i=0;i<count2;i++){
        printf("%d\n",ans[i]);
    }
    return 0;
     
}
