I took a stab at the question, but I don't think I did it right.
I know that Work = Change in Energy
thus, Work = final energy - initial energy
Because there is no energy at the final position, then final energy = 0 (I'm not sure if this is correct).
So I got the equation W = 0 - (1/2kA^2 +...