Wowo is a solo adventurer who completed many dangerous journeys on his own foot in forests, deserts and even glaciers. The Shanghai ICPC (Shanghai Invitational Contest on Programmable Cheating) committee invited Wowo as a tester of their new running trial.
The trial can be described as a 2D simple polyline
)
. In other words, the trial consists of

line segments
%2C%5Cldots%2C%20(p_%7Bn-1%7D%2C%20p_n))
. The line segments do not intersect with each other except that two consecutive line segments
)
and
)
intersect at the point

. Any two consecutive segments have different directions. The committee wants Wowo to run from

to

along the line segments
%2C%5Cldots%2C%20(p_%7Bn-1%7D%2C%20p_n))
in order.
However, Wowo has a smart device that can hack the committee's system for an interval of time. Wowo is able to choose 2 points

on the trial and run directly from

to

along the line segment
%7D)
. Each of these

and

can be some

(

) and can be some point on some line segment
)
(

) as well. Before reaching

and after reaching

, Wowo has to run along the original trial. Wowo does not want to be caught cheating, so he decided that the line segment
%7D)
should not intersect or touch any line segment of the trial at any point other than

and

. Help Wowo to choose

and

wisely and output the shortest distance Wowo need to run from

to

using his smart cheating device.