#include<iostream>
using namespace std;

int main(){
    int n, d, k, sum=0, ch1, ch, P;
    cin>>n>>d>>k;
    P=k-1;
    ch1=1+d;
    if(ch1>=n){
        ch=ch-n;
        if(ch=0){
            sum++;
        }
        sum=sum+ch;
    }
    else{
         for(int z=0; z<=P; z++){
        if(sum>n){
            ch=sum-n;
            sum=sum+ch;
        }
        else
        {
            sum=sum+ch1;
        }
    }
    sum+=ch1;
    cout<<sum-6;
    }

    return 0;
}
