#define TEST
#undef TEST //提出時にはこれをコメントアウトしないようにすること

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using sc = Scanner;

class Program
{

    static void Main(string[] args)
    {
        
        var q = new AnswerCollecter<int>();

        const int maxSizeHurui = 1000000;
        int[] hurui = new int[maxSizeHurui];
        for (int i = 2; i < maxSizeHurui ; i++)
        {
            hurui[i] = i;
        }
        //合成数を0にしていくようにふるいに掛ける
        for (int i = 2; i < maxSizeHurui; i++)
        {
            if (hurui[i] != 0) //iが素数
            {
                for (int j = 2 * i; j < maxSizeHurui; j += i)
                {
                    if (hurui[j] % j == 0) hurui[j] = 0;
                }
            }
        }
        while (true)
        {
            int a = sc.NextInt();
            if (a == 0) break;
            int d = sc.NextInt();
            int n = sc.NextInt();
            int count = 0;
            int an = a;
            for (int i = 0; an <= 1000000; i++ )
            {
                if(hurui[an] != 0) count++;
                if (count == n)
                {
                    q.Enqueue(an);
                    break;
                }
                an += d;
            }           
        }
        q.Answer();
#if TEST
    Console.ReadLine();
#endif
    }


}

public class AnswerCollecter<T>
{
    private Queue<T> q;



    public AnswerCollecter()
    {
        q = new Queue<T>();
    }

    public void Enqueue( T item)
    {
        q.Enqueue(item);
    }

    public void Answer()
    {
        while (q.Count != 0)
            Console.WriteLine(q.Dequeue());
    }
    public int Count()
    {
        return q.Count;
    }
}
   
public static class Scanner
{
    public static string NextString()
    {
        string tmp = "";
        while (true)
        {
            string readData = char.ConvertFromUtf32(Console.Read());
            if (readData == " " || readData == "\n")
                break;
            tmp += readData;
        }
        return tmp;
    }

    public static string[] NextStrArray()
    {
        return Console.ReadLine().Split(' ');
    }

    public static long[] NextLongArray()
    {
        string[] s = NextStrArray();
        long[] a = new long[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = long.Parse(s[i]);
        }
        return a;
    }
    public static int[] NextIntArray()
    {

        string[] s = NextStrArray();
        int[] a = new int[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = int.Parse(s[i]);
        }
        return a;
    }
    public static int NextInt()
    {
        string tmp = "";
        while (true)
        {
            string readData = char.ConvertFromUtf32(Console.Read());
            if (readData == " " || readData == "\n")
                break;
        
            tmp += readData;
        }
        return int.Parse(tmp);
    }
    public static double NextDouble()
    {
        string tmp = "";
        while (true)
        {
            string readData = char.ConvertFromUtf32(Console.Read());
            if (readData == " " || readData == "\n")
                break;
            tmp += readData;
        }
        return double.Parse(tmp);
    }
    public static long NextLong()
    {
        string tmp = "";
        while (true)
        {
            string readData = char.ConvertFromUtf32(Console.Read());
            if (readData == " " || readData == "\n")
                break;
            tmp += readData;
        }
        return long.Parse(tmp);
    }
    public static double[] NextDoubleArray()
    {

        string[] s = NextStrArray();
        double[] a = new double[s.Length];
        for (int i = 0; i < a.Length; i++)
        {
            a[i] = double.Parse(s[i]);
        }
        return a;
    }
}

Measured memory_bytes: 9964