#C3035. Taco Connection Value

    ID: 46418 Type: Default 1000ms 256MiB

Taco Connection Value

Taco Connection Value

You are given a grid and m line segments. Each segment is described by its two endpoints. Your task is to calculate the maximum connection value, defined as the sum of the Euclidean distances of these segments.

The Euclidean distance between two points \( (x_1, y_1) \) and \( (x_2, y_2) \) is computed as follows:

\[ \sqrt{(x_1-x_2)^2+(y_1-y_2)^2} \]

Given all segments, compute the total connection value and output it with a precision of 9 decimal places.

inputFormat

The input is given from stdin and consists of:

  • The first line contains two integers n and m, where n represents the grid size (not used in computations) and m is the number of segments.
  • The next m lines each contain 4 integers: x1, y1, x2, y2, representing the endpoints of a segment.

outputFormat

Output the sum of the Euclidean distances of all segments to stdout, formatted with a precision of 9 decimal places.

## sample
5 3
1 1 1 2
2 3 2 4
3 3 4 3
3.000000000