#include <iostream>
using namespace std;

int main()
{
    int n = 0, d = 0, k = 0, suma = 1, current = 1;
    cin >> n >> d >> k;
    for (int i = 0; i < k; i++)
    {
        if ((current + d) % n == 0)
        {
            current = current + d;
            suma = suma + n;
        }
        else
        {
            current = current + d;
            suma = suma + current % n;
        }
    }
    cout << suma << endl;
    return 0;
}
