Externalities and total surplus in the market