awk -M '\

function floor(x){
    x+=0
    if(x%1){
        if(x>0)return int(x);
        else   return int(x)-1;
    }else      return x; 
}
function f(x){
    return floor(A*x/B) - A*floor(x/B)
}
{
    A = $1;
    B = $2;
    N = $3;
    if(B-1>N)print f(N)
    else print f(B-1)
}'