output total distance