solving problem profit