TeX source:
\frac{1-p}{\bar{w} - p\frac{\bar{w}}{2}. Setting this to 0 gives \(\bar{w} \propto \frac{1}{\sqrt{p}}