I'd suggest you sketch this situation. If you did, you'd likely see right away that the shortest distance back to the starting point would be the hypotenuse of the right triangle whose legs are of lengths 5 miles and 12 miles.
Apply the Pythagorean Theorem to solve this.