def floor_Max(A,B,N): x = min(B - 1,N) return (A*x) // B