A transparent measuring tape has six distinct marked integer positions: two red, two blue, and two yellow. Fold the tape to make the red marks coincide, then fold the resulting tape to make the blue marks coincide, and finally do the same for the yellow marks. If the next pair already coincides, leave the tape as it is.
Determine the length of the folded tape.
Input
The first line contains the original length $L$, in centimetres, with $10\le L\le1000$.
The following three lines contain the positions of the red, blue, and yellow pairs, respectively. All six positions are distinct integers on the tape, measured from its beginning.
Output
Print the final length with exactly one digit after the decimal point, including a trailing zero when necessary.
Sample
10
2 7
5 4
10 3
3.5
Sample Explanation
The tape initially has length $10$ cm. The red marks are at $2$ cm and $7$ cm, the blue marks at $5$ cm and $4$ cm, and the yellow marks at $10$ cm and $3$ cm.

The first fold is at $4.5$ cm. The two parts have lengths $4.5$ cm and $5.5$ cm, so the folded tape has length $5.5$ cm. The blue marks already coincide, so the second fold is skipped. Folding to bring the yellow marks together leaves a tape of length $3.5$ cm.