This is LaTeX code:

[latex]
=\left(1+\frac{(p-1)p(p+1)}{2}\right)\left(2+p(p+1)\right)=
[/latex]