#include <iostream>
using namespace std;
int main ()
{
    int n,d,k,sum,ost=0;
    cin>>n>>d>>k;
    sum=2+d;
    k--;
     if (sum+d-1>n)
        {
            ost=(sum+d-1)%n;
            sum=sum+ost;
        }
        else sum=sum*2+d-1;
        k--;
    while (k!=0)
    {
         if (ost+d<=n)
        {
            if (ost+d==n) ost=ost+d;
            else ost=(ost+d)%n;
            sum=sum+ost;
        }
        else
        {
            ost=(ost+d)%n;
            sum=sum+ost;
        }
        k--;

    }
    cout<<sum;
    return 0;
}
