Crazily Difficult Optimization problem Please help

An offshore oil well is located in the ocean at a point W, which is 5 miles from the closest point on the shore A on a straight line shoreline. the oil is to be piped to a point B in the shore that is 8 miles from A, by piping it on a straight line underwater to some point on the shore P between A and B and then on to B via pipe along the shoreline. if the cost of laying pipe is $100,000 per mile under water and $75,000 per mile over land, where should point P be located to minimize the cost of the laying pipe?

Help will be very much appreciated, I have no idea where to start or what to do.