Solution (source code)

= Solution

Let $X$ increase along the handle, with zero at the centre of the circular head. The ring has its <centre of mass> at $X=0$. The rod occupies $a\leq X\leq a+l$, so its <centre of mass> is at $a+l/2$. The mass-weighted mean is therefore
$$
\boxed{X_{\mathrm{CM}}=\frac{M_l(a+l/2)}{M_a+M_l}.}
$$
This uses the source diagram's rim-to-end handle length $l$, not a rod beginning at the head's centre.