13.418 Two cyclists leave point $A$ simultaneously at different speeds and head for point $B$. Upon reaching it, they immediately turn back. The first cyclist, who was faster than the second, meets the second one on the return trip at a distance of $a$ km from $B$; then, after reaching $A$, he heads again towards $B$ and, having traveled $\boldsymbol{k}$-th of the distance $A B$, meets the second cyclist, who is returning from $B$. Find the distance from $\boldsymbol{A}$ to $\boldsymbol{B}$.
Solution. Let $z$ be the distance between $A$ and $B$, $x$ and $y$ be the speeds of the cyclists. By the time of the first meeting, the first cyclist has traveled a distance of $z+a$, and the second cyclist has traveled $z-a$, hence $\frac{z+a}{z-a}=\frac{x}{y}$. By the time of the second meeting, the first cyclist has traveled $2 z+\frac{z}{k}$ km, and the second cyclist has traveled $\left(z+\frac{k-1}{k} z\right)$ km, hence $\frac{(2 k+1) z}{(2 k-1) z}=\frac{x}{y}$.

In the end, we have: $\frac{z+a}{z-a}=\frac{2 k+1}{2 k-1} \Rightarrow z=2 a k$.

Answer: $2 a k$ km.