Solution as requested by PM. Excuse the little ASCII art diagrams.
Before first collision: --v--> A B
After first collision: <--a1--A B--b1-->
Cons momentum (1): 5b1-4a1 = 4u.
Law of restitution (2): a1+b1 = eu
(1)+4 x (2): 9b1=(4e+4)u
(2) x 5 - (1): 9a1=(5e-4)u
Before collision with wall: <--a1--A B--b1-->
After collision with wall: <--a2--A B<--b2--
b2 = eb1, so 9b2 = (4e^2+4e)u. Nothing happened to a, so a2 = a1.
Before final collision: <--a2--A B<--b2--
After final collison: <--a3--A
Cons momentum: 4a3 = (4a2+5b2)u = (20e-16+20e^2+20e)u/9 = 4(5e^2+10e-4)u/9
Law of restitution (4): a3 = e (b2-a2) = e(4e^2+4e-5e+4)u/9 = (4e^3-e^2+4e)u/9
Equating the two expressions for a3 gives:
So (4e^3-e^2+4e) - (5e^2+10e-4) = 0. That is, 4e^3-6e^2-6e+4 = 0, or 2e^3-3e^2-3e+2 = 0.