find the work done by the external agent till the maximum compression of the spring.