1684 - Room

Time Limit : 1 Second

Memory Limit : 512 MB

Submission: 20

Solved: 6

Description

Today, pyy will pass through a room which is 10 in length and width. 


We define the left-bottom point of room as the original point.


The entrance is at (0,5), and the exit is at (10,5)


There are N walls in the room. Each wall has two opening.



Can you find the shortest path to help pyy?

Input

We have multiply cases. For each case:


The First line contains a numbers: N (1 <= N <= 20)


From Second to N + 1 line each line contains 3 floats, x1, y1i, y2i, (0 < x1 < 10, 0 < y1i < y2i <10) representing a wall and its opening.

Output

For each case, you should output the length of the shortest path(accurate to two decimal places).

sample input
2
4 2 7
7 3 4.5
sample output
10.06
hint
source
© 2015 HUST ACMICPC TEAM. All Right Reserved.