<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cost(self, i, j):
 """Returns the distance between the end of path i and the start of path j."""

        return dist(self.endpoints[i][1], self.endpoints[j][0])