You have the distance between the ships as 4km. It's also relatively easy to see that the angles in the triangle are. This is enough information to use the Sine Rule to evaluate the length from where the ship started to the lighthouse.
Once you have that length, it becomes the hypotenuse of a right angle triangle with d as the vertical length and an adjacent angle of. You should be able to evaluate that distance.