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