45 (1287). A rider and a pedestrian simultaneously set off from point $A$ to point $B$. The rider, arriving in $B$ 50 minutes earlier than the pedestrian, returned back to $A$. On the return trip, he met the pedestrian 2 kilometers from $B$. The rider spent 1 hour and 40 minutes on the entire journey. Find the distance from $A$ to $B$ and the speed of the rider and the pedestrian.