Answer
$S_B=5.7m$
Work Step by Step
The required distance can be determined as follows:
We know that
$3v_A=-v_B$
$\implies v_B=-3(3)=-9m/s$
According to the conservation of energy
$T_{A_{\circ}}+T_{B_{\circ}}+V_{A_{\circ}}+V_{B_{\circ}}=T_A+T_B+V_A+V_B$
$\implies 0+0+0+0=\frac{1}{2}m_Av_A^2+\frac{1}{2}m_Bv_B^2+W_A S_A+W_BS_B$
We plug in the known values to obtain:
$0=\frac{1}{2}(20)(3)^2+\frac{1}{2}(30)(-9)^2+(20)(9.81)(\frac{S_B}{3})-(30)(9.81)(S_B)$
This simplifies to:
$S_B=5.7m$