This distance model can be represented best by a right triangle. AB and BC are the legs, and AC is the hypotenuse. By plugging the known values into the pythagorean theorem, a^2 + b^2 = c^2, we can get our answer. 3^2 + 4^2 = c^2. 9 + 16 = c^2. c^2 = 25. Finally, our answer is 5km.
Hope this helps!