Add constant to the distance function