A man is sitting in a lake in his boat fishing when he receives a call on his cell phone. A barbecue is happening a ways down the shoreline, and he had better get there fast so as not to miss out. He is two miles out perpendicular to the shore, and 7 miles horizontally from the location on the beach from the barbecue. If the lake has no current and the wind is negligible, he can row toward the shoreline at a rate of 3 mph. When he reaches dry land, he can run at 5 miles per hour. If he wants to reach the barbecue as quickly as possible, how far horizontally should he land the boat from his current location?
As a bonus, if we assign the distance from the shore to be A miles, the distance from the barbecue along the shoreline B miles, and the boat speed and running speed C and D miles per hour respectively, does there exist a function that will output the ideal place to land the boat for all positive values of A,B,C, and D? If so, what is it? If not, why not?