Mr Li wanted to buy 200 boxes of apples but found that he was short by $300. He decided to buy 160 boxes instead and had $180 left. After that, he sold the apples for 30 cents each. 95 of the apples were rotten but he sold all the rest of the apples. If each box contained 50 apples, how much profit did he make?