Planckian energy scattering and surface terms in the gravitational action