uses testlib,SysUtils;
const
	MaxN = 100000;
	eps  = 1e-4;
var
	x,y,d_a,d_b: array [1..MaxN+4] of extended;
	N: longint;
	L: extended;
	x1,y1,x2,y2: extended;
	Ax,Ay,Bx,By: extended;
	A,B: longint;
	ll,rr: longint;
	jans,cans: extended;

function min(x,y:extended): extended;
begin
	if x < y then
		min := x
	else
		min := y
end;

function find_on_curve(xx,yy: extended): longint;
var
	i: longint;
begin
	for i := 1 to N - 1 do begin
		if xx < x[i] - eps then continue;
		if xx > x[i+1] + eps then continue;
		if abs((xx - x[i])*(y[i+1] - y[i]) - (x[i+1] - x[i])*(yy - y[i])) < eps*(abs(x[i+1] - x[i]) + abs(y[i+1] - y[i])) then begin
			find_on_curve := i;
			exit;
		end;
	end;
	find_on_curve := -1;
end;

function slength(x1,y1,x2,y2: extended): extended;
begin
	slength := sqrt(sqr(x2-x1) + sqr(y2-y1));
end;

function path_length(p,q,r,s: longint; x1,y1,x2,y2: extended): extended;
begin
	path_length := min(slength(x[p],y[p],x1,y1) + d_a[p],slength(x[q],y[q],x1,y1) + d_a[q]) +
		       slength(x1,y1,x2,y2) +
		       min(slength(x[r],y[r],x2,y2) + d_b[r],slength(x[s],y[s],x2,y2) + d_b[s]);
end;
	
var
	i,j: longint;
	xx,yy: extended;
begin
	N := inf.readlongint;
	L := inf.readreal;
	Ax := inf.readreal; Ay := inf.readreal;
	Bx := inf.readreal; By := inf.readreal;
	for i := 1 to N do begin
		x[i] := inf.readreal;
		y[i] := inf.readreal;
	end;
	A := find_on_curve(Ax,Ay);
	for i := N+1 downto A+2 do begin
		x[i] := x[i-1];
		y[i] := y[i-1];
	end;
	x[A+1] := Ax; y[A+1] := Ay;
	inc(N); inc(A);
	B := find_on_curve(Bx,By);
	for i := N+1 downto B+2 do begin
		x[i] := x[i-1];
		y[i] := y[i-1];
	end;
	x[B+1] := Bx; y[B+1] := By;
	inc(N); inc(B);
	if B <= A then begin 
		inc(A);
		j := A; 
		A := B;
		B := j;
	end;
	
	d_a[A] := 0;
	for i := A-1 downto 1 do d_a[i] := d_a[i+1] + slength(x[i],y[i],x[i+1],y[i+1]);
	for i := A+1 to N do d_a[i] := d_a[i-1] + slength(x[i],y[i],x[i-1],y[i-1]);
	d_b[B] := 0;
	for i := B-1 downto 1 do d_b[i] := d_b[i+1] + slength(x[i],y[i],x[i+1],y[i+1]);
	for i := B+1 to N do d_b[i] := d_b[i-1] + slength(x[i],y[i],x[i-1],y[i-1]);
	
	jans := ans.readreal;
	x1 := ouf.readreal;
	y1 := ouf.readreal;
	ll := find_on_curve(x1,y1);
	if ll < 0 then quit(_wa,'Конец моста не лежит на ломаной');
	x2 := ouf.readreal;
	y2 := ouf.readreal;
	rr := find_on_curve(x2,y2);
	if rr < 0 then quit(_wa,'Конец моста не лежит на ломаной');
	if abs(y2-y1) > eps then quit(_wa,'Мост не горизонтальный');
	if abs(x2-x1) > L + eps then quit(_wa,'Мост слишком длинный');
	if ll > rr then begin
		j := ll; ll := rr; rr := j;
		xx := x1; x1 := x2; x2 := xx;
		yy := y1; y1 := y2; y2 := yy;
	end;
	for i := ll + 1 to rr do begin
		if y[i] > y2 + eps then
		quit(_wa,'Мост не может идти под землей');
	end;
	cans := min(path_length(ll,ll+1,rr,rr+1,x1,y1,x2,y2),d_a[B]);

	if cans < jans - eps*2*sqrt(2) then quit(_fail,'Решение участника лучше!!!');
	if jans < cans - eps*2*sqrt(2) then quit(_wa,format('Дорога неоптимальной длины: %0.5f вместо %0.5f',[cans, jans]));
	quit(_ok,format('Верное решение (%d вершин, длина пути %0.5f)',[N,cans]));
end.
