Multiply

(a+p)(a^2-ap+p^2)

Am I supposed to line these up then multiply a^2-ap+p^2 by p then by a?

Yes!