update TotalDistanceCities function