how to calculate total distance traveled