Differentating $v(s)$ with respect to time
$$
\frac{d v}{d t}=\frac{a}{2 \sqrt{s}} \frac{d s}{d t}=\frac{a}{2 \sqrt{s}} a \sqrt{s}=\frac{a^{2}}{2}=w
$$
(As locomotive is in unidrectional motion) Hence force acting on the locomotive $F=m w=\frac{m a^{2}}{2}$ Let, at $v=0$ at $t=0$ then the distance covered during the first $t$ seconds
$$
s=\frac{1}{2} w t^{2}=\frac{1}{2} \frac{a^{2}}{2} t^{2}=\frac{a^{2}}{4} t^{2}
$$
Hence the sought work, $A=F s=\frac{m a^{2}}{2} \frac{\left(a^{2} t^{2}\right)}{4}=\frac{m a^{4} t^{2}}{8}$