A small smooth sphere $A$ of mass $m$ moves with speed $u$ on a smooth horizontal surface and collides directly with an identical sphere $B$, initially at rest. The coefficient of restitution between the spheres is $e$. Sphere $B$ subsequently collides with a fixed vertical barrier perpendicular to its direction of motion; the coefficient of restitution at the barrier is $\tfrac12$. Given that $80\%$ of the initial kinetic energy is lost in the two collisions, find $e$. [8]