4B. Find all values of the real parameter $a \neq 0,1$ for which the equations $x^{2}-(2 a+1) x+a=0$ and $x^{2}+(a-4) x+a-1=0$ have real roots $x_{1}, x_{2}$ and $x_{3}, x_{4}$, respectively, such that the equality

$$
\frac{x_{1}}{x_{3}}+\frac{x_{4}}{x_{2}}=\frac{x_{1} x_{4}\left(x_{1}+x_{2}+x_{3}+x_{4}\right)}{a}
$$

is satisfied.
The given equation is equivalent to

$$
a\left(x_{1} x_{2}+x_{3} x_{4}\right)=x_{1} x_{2} x_{3} x_{4}\left(x_{1}+x_{2}+x_{3}+x_{4}\right)
$$

From Vieta's formulas, we obtain the equation $a(2a-1)=a(a-1)(a+5)$. Since $a \neq 0$, we get the quadratic equation $a^{2}+2a-4=0$, whose solutions are $-1-\sqrt{5}$ and $-1+\sqrt{5}$.