how to solve problems on profit and loss