But if you mean what I said above then there's two ways to answer this. The A-level way is just W=Fs. Use Newton's Law of Gravitation for the force and remember that the distance in this scenario is the radius r.
The formal way is to integrate the gravitational force (again from Newton's Law) with respect to r but between the upper and lower limits of infinity and r respectively.