#include <iostream>
using namespace std;
int main ()
{
    int n,d,k,sum=1,br=1;
    cin>>n>>d>>k;
    for(int i=1; k>0; i++)
    {
        sum=sum+((br+d)%n);
        if ((br+d)/n==0 )sum=sum+n; 
        br+=d;
        k=k-1;
    }
    cout<<sum;
    return 0;
}
