solved the profit formula