Solve for x mx+nx=p