Solving a system of equation and finding the largest possible value of one of the variables This problem comes from question 5 in the PUMAC Algebra A competition (link here):

Suppose $w, x, y, z$ satisfy $$w+x+y+z=25$$ $$wx+wy+wz+xy+xz+yz=2y+2x+193$$ The largest possible value of $w$ can be expressed in lowest terms as $w_1/w_2$ for some integers $w_1, w_2 > 0$. Find $w_1+w_2$.

How would you find the solutions to this equation? I don't realy understand how to solve the problem, and their solution confused me a lot. I understand that you would have to use inequalities for $w$ in order to find it's largest possible value, but I don't know how to find that inequality. 
Any help/hints is greatly appreciated.
 A: I guess I can explain their solution in more detail here*. So first (which they in fact do last  in their solution), we want to get rid of the $2y+2x$ on the RHS of the second equation. We can do this via the slick substitution $(W,X,Y,Z)=(w-1,x+1,y+1,z-1)$ which gives us
$$(W+1)(X+Y+Z-1) + (Y-1)(Z+X) + (X-1)(Z+1) = 2X-2+2Y-2+193$$
$$W(X+Y+Z)+XY+YZ+ZX-W-Z+X+Y-2=2X+2Y+193-4$$
And then we can add the first equation $W+X+Y+Z=25$ and we then get
$$W(X+Y+Z)+XY+YZ+ZX=193+25-2=216$$
Now we are left with finding the maximum of $W$  with the above equation and the constraint $$X+Y+Z+W=25$$
We do this via the inequality $(X+Y+Z)^2\geq 3(XY+YZ+ZX)$, which is a direct result of the fact that $$(X-Y)^2+(Y-Z)^2+(Z-X)^2 \geq 0$$
This is all motivated because the term $X+Y+Z$ is quite nice since we can replace it by $25-W$. So now we have
$$216 \leq W(25-W) + \frac{(25-W)^2}{3}$$
$$-75W+3W^2+216*3-25^2+50W-W^2 \leq0$$
$$2W^2-25W+23\leq0$$
Since the $W^2$ term has a positive coefficient, the $W$ which satisfy this inequality lie in the region between the two solutions, so the maximum solution is also the maximum $W$ and thus we have
$$W\leq \frac{25+\sqrt{25^2-4*2*23}}{2*2}=\frac{25+\sqrt{441}}{4}=\frac{23}{2}$$
And then remembering to switch back to $w=W+1$ we have
$$w\leq \frac{25}{2}$$ so our solution is $25+2=27$.
*(also, you changed their z to an x so I went along with that here)
