Check the picture below.
so then, let's use the pythagorean theorem to find "x" and "y", and the distance is just x+y.
[tex]\bf \textit{using the pythagorean theorem} \\\\ c^2=a^2+b^2\implies c=\sqrt{a^2+b^2} \qquad \begin{cases} c=\stackrel{hypotenuse}{x}\\ a=\stackrel{adjacent}{9}\\ b=\stackrel{opposite}{5}\\ \end{cases} \\\\\\ x=\sqrt{9^2+5^2}\implies x=\sqrt{81+25}\implies x=\sqrt{106} \\\\[-0.35em] ~\dotfill[/tex]
[tex]\bf \textit{using the pythagorean theorem} \\\\ c^2=a^2+b^2\implies c=\sqrt{a^2+b^2} \qquad \begin{cases} c=\stackrel{hypotenuse}{y}\\ a=\stackrel{adjacent}{17}\\ b=\stackrel{opposite}{5}\\ \end{cases} \\\\\\ y=\sqrt{17^2+5^2}\implies y=\sqrt{289+25}\implies y=\sqrt{314} \\\\[-0.35em] ~\dotfill\\\\ \stackrel{\textit{total distance}}{x+y}\implies \sqrt{106}+\sqrt{314}\qquad \approx 10.296+17.72\qquad \approx 28.016[/tex]