Submit

You live in a small town with *R* bidirectional roads connecting *C* crossings and you want to go from crossing 1 to crossing *C* as soon as possible. You can visit other crossings before arriving at crossing C, but it’s not mandatory.

You have exactly one chance to ask your friend to repair exactly one existing road, __from the time you ____leave__** crossing 1**. If he repairs the

You cannot start to cross the road when your friend is repairing it.

There will be at most 25 test cases. Each test case begins with two integers *C* and *R* (2<=*C*<=100, 1<=*R*<=500). Each of the next *R* lines contains two integers *x** _{i}*,

For each test case, print the smallest time it takes to reach crossing *C* from crossing 1, rounded to 3 digits after decimal point. It’s always possible to reach crossing *C* from crossing 1.

```
3 2
1 2 1.5 1.8
2 3 2.0 1.5
2 1
1 2 2.0 1.8
0 0
```

```
2.589
1.976
```