#K64862. Total Distance Traversal

    ID: 32070 Type: Default 1000ms 256MiB

Total Distance Traversal

Total Distance Traversal

You are given a list of checkpoints represented by their coordinates in a 2-dimensional plane. The task is to calculate the total Euclidean distance a player must travel to go through the checkpoints sequentially. The total distance is calculated as:

$$ D = \sum_{i=1}^{n-1} \sqrt{(x_i - x_{i-1})^2 + (y_i - y_{i-1})^2} $$

where \( (x_0, y_0), (x_1, y_1), \dots, (x_{n-1}, y_{n-1}) \) are the coordinates of the checkpoints.

Read the input from standard input and write the result to standard output. The answer will be considered correct if it is within an absolute or relative error of \(10^{-6}\) of the correct answer.

inputFormat

The first line contains an integer \(n\) (\(n \ge 2\)), the number of checkpoints. The next \(n\) lines each contain two space-separated integers representing the coordinates \(x\) and \(y\) of a checkpoint.

outputFormat

Output a single floating point number, the total Euclidean distance to traverse the checkpoints in order. Your answer should be accurate to at least 6 decimal places.

## sample
2
0 0
3 4
5.000000