April is taking a road trip with her friends! April's world can be represented by a coordinate plane, where she starts at . There are attractions with coordinate positions she would like to visit. She must visit these coordinates in order, and can travel in a straight line between attractions.
Given a list of attractions to visit in order, can you calculate the total distance traveled?
Input Specification
The first line of input will contain one integer, , the number of attractions to visit.
The next lines will each contain two integers and , the coordinates of the attraction.
Output Specification
Output the total distance traveled.
Do not round your output. Outputs with a precision error of will be accepted.
Subtasks
Subtask 1 [15%]
Subtask 2 [25%]
Subtask 3 [60%]
No further constraints.
Sample Input 1
3
0 1
2 2
3 3
Sample Output 1
4.6502815399
Sample Explanation
This is a diagram of April's trip. Notice how she travels in a straight line between the attractions in the order that they are given.
Remember that the distance between two points on a Cartesian plane is calculated using the Pythagorean Theorem.
Sample Input 2
5
-2 3
4 -5
5 1
0 1
6 -2
Sample Output 2
31.39651773
Comments