#K86712. Bird Journeys

    ID: 36926 Type: Default 1000ms 256MiB

Bird Journeys

Bird Journeys

You are given the flight paths of m birds. For each bird, a sequence of waypoints in a 2-dimensional plane is provided. The journey for each bird starts with an integer k which denotes the number of waypoints, followed by k pairs of integers representing the x and y coordinates of each waypoint. The birds fly in a straight line between consecutive waypoints.

Your task is to compute the total distance travelled by each bird. The distance between two points \( (x_1, y_1) \) and \( (x_2, y_2) \) is given by the Euclidean distance formula:

\( d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} \)

Print the computed journey distance for each bird on a separate line, formatted to 10 decimal places.

inputFormat

The first line of input contains a single integer m, representing the number of birds.

This is followed by m lines, each describing one bird's journey. Each line starts with an integer k (the number of waypoints), followed by 2*k integers denoting the x and y coordinates of the waypoints in order.

outputFormat

Output m lines; each line contains the total distance of the corresponding bird's flight path, formatted to 10 decimal places.

## sample
2
3 0 0 3 4 6 0
4 1 1 2 2 3 3 4 4
10.0000000000

4.2426406871

</p>