$A$ vertical spring with force constant $k$ is fixed on a table. $A$ ball of mass m at a height h above the free upper end of the spring falls vertically on the spring so that the spring is compressed by a distance $d$ . The net work done in the process is