#include<stdio.h>
#include<stdlib.h>

int main(void)
{
	int i,j,c;
	int a,d,n;
	char *p;
	
	p = (char *)malloc(sizeof(char)*1000000);
	
	p[0]=0;
	p[1]=0;
	for(i=2;i<1000000;i++)
	{
		p[i]=1;
	}
	
	c = 2;
	
	while(1)
	{
		if(p[c])
		{
			for(i=2*c;i<1000000;i+=c)
			{
				p[i]=0;
			}
		}
		while(p[++c]==0);
		if(c>1000)break;
	}
	
	while(1)
	{
		scanf("%d %d %d ",&a,&d,&n);
		if(a == 0 && d == 0 && n == 0)break;
		c = 0;
		i = 0;
		while(1)
		{
			if(p[a+i*d]){c++;}
			if(n==c)
			{
				printf("%d\n",a+i*d);
				break;
			}
			i++;
		}
	}
	
	return 0;
	
}