Gain in kinetic energy = Loss in potential energy.
\displaystyle \begin{align} & 40\times 9 \textrm{.}8\times 12=\frac{1}{2}\times 40\times {{v}^{2}} \\ & v=15 \textrm{.}3\text{ m}{{\text{s}}^{\text{-1}}} \end{align}