So for this we will be using the pythagorean theorem, which is

. The a and b variable stand for the legs of the triangle and c represents the hypotenuse.
So to start, replace a and c variable with 39 and 65. Your equation should look like this:

. From here we can solve.
Solve the exponents to get

Subtract 1521 on each side to get

Square root each side and your answer should be

km