function Main(input) {
    input = input.split(" ").map(x => parseInt(x));
    var ans = 0;
    var str = "";
    var time = 0;
    var i =0;
    for(i = 0; i<input[0]; i++){
        if( Math.abs(input[1]-input[2])==1){
            str = "win both or lose both";
        }
        else if( input[1] < input[2]){
            str = "second win";
        }
        else{
            str = "first win";
        }
        switch(str){
            case "win both or lose both" :
                {   
                    if(input[1]<input[2])
                    ans= input[1];
                    else
                    ans= input[2];
                }
                break;
            case "first win":
                {
                    while(input[1]!=input[2]){
                        input[1]--;
                        input[2]++;
                        ans++;
                    }
                }
                break;
            case "second win":
                {
                    while(input[1]!=input[2]){
                        input[1]++;
                        input[2]--;
                        ans++;
                    }
                }
                break;
            default:
                ans=0;
        }
    }
    console.log(ans);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));