Solve SRM 153, Div 2, Problem MostProfitable