tsp distance calculation