The trick of it is to find what you want to optimize. In this case it would be miles per dollar.
You are given miles/gallon, dollars/gallon, miles/hour, and dollars/hour.
Your equation will be made up of two pieces, your fuel miles/dollar and your driver's miles/dollar. The sum of these will create your total miles/dollar.
Once your equation is set up it is straight forward optimization.