Determining profit-maximizing level of output