The structure of the distortion free-energy density in nematics: Second-order elasticity and surface terms