Solution (source code)

= Solution

Condition on whether replacement occurs. Both alternatives have blue second-draw <probability> $2/5$, so the <law of total probability> gives
$$
\boxed{P(B_2)=r\frac25+(1-r)\frac25=\frac25,\qquad0\le r\le1.}
$$