Finding the Total Distance