Problem with differentiating with respect to a-schermafbeelding-2013-02-15-om-17.22.23.png

Hey guys, I hope you can explain me something.
I got this huge problem with differentiating with respect to a:
In the uploaded file you can see the function:
I have typed it in word as well and than it looks like this:

1.The start : (1/2h)*(h+a))* 1/2K*[g+K+1/2*(h-a)]*(p+1/2(h-a).

2. Using the chain rule: F*G+F* G=-(1/2)*{(1/2h)*(h+a)*1/2K*(g+K+(1/2*(h-a)))} * (p+1/2(h-a) +
{(1/2h)*(h+a)* 1/2K*[g+K+1/2*(h-a)]}*-1/2.

3. The answers has to become this 4(g+K)*p -4(g+K+p+1/2h)*a+ 3a^2- h^2= 0.

I have no clue how to come from step 2. to step 3.

I hope somebody is able to help and write it down in steps for me
Many, many thanks.