program laser;
type pct=record x,y:real end;
const INF=1000000000;
var
a:array[1..100] of pct;
i,n,R:longint;
min:real;
l:pct;
fi,fo:text;
function dist(p1,p2:pct):real;
var a:real;
begin
a:=(p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y);
dist:=sqrt(a);
end;
function dist2(x1,x2,l:pct):real;
var
a,b,c,cos1,cos2,u1,u2,p:real;
begin
a:=dist(x1,x2);
b:=dist(x1,l);
c:=dist(x2,l);
cos1:=(b*b-c*c-a*a)/(-2*(a*c));
cos2:=(c*c-b*b-a*a)/(-2*(a*b));
{u1:=arctan(sqrt(1-sqr(cos1))/cos1);
u2:=arctan(sqrt(1-sqr(cos2))/cos2);}
p:=(a+b+c)/2;
if (cos1>0)and(cos2>0)
then dist2:=2*sqrt(p*(p-a)*(p-b)*(p-c))/a
else dist2:=INF;
end;
function inters(a1,a2,a3,a4:pct):boolean;
var a,b,c:real;
begin
{a:=a1.y-a2.y;
b:=a2.x-a1.x;
c:=a1.y*a2.x-a1.x*a2.y;
}
if((a3.x*(a1.y-a2.y)+a3.y*(a2.x-a1.x)+a2.y*a1.x-a2.x*a1.y)*(a4.x*(a1.y-a2.y)+a4.y*(a2.x-a1.x)+a2.y*a1.x-a2.x*a1.y)>0)
then begin
inters:=false;
exit;
end
else if((a1.x*(a3.y-a4.y)+a1.y*(a4.x-a3.x)+a4.y*a3.x-a4.x*a3.y)*(a2.x*(a3.y-a4.y)+a2.y*(a4.x-a3.x)+a4.y*a3.x-a4.x*a3.y)>0)
then begin
inters:=false;
exit;
end;
inters:=true;
end;
function interior(x:pct):boolean;
var i,t:integer;
e:pct;
begin
randomize;
e.x:=10000+random(50);
e.y:=10000+random(50);
t:=0;
for i:=1 to n do
if inters(a[i],a[i+1],e,l)
then t:=t+1;
if t=1
then interior:=true
else interior:=false;
end;
begin
assign(fi,'laser.in');
reset(fi);
read(fi,n);
for i:=1 to n do
read(fi,a[i].x,a[i].y);
a[n+1]:=a[1];
read(fi,l.x,l.y,R);
close(fi);
assign(fo,'laser.out');
rewrite(fo);
{verificare daca punctul este in interiorul poligonului}
if interior(l)
then begin
writeln(fo,0.000:0:3);
close(fo);
halt;
end;
for i:=1 to n do
if (a[i].x=l.x) and (a[i].y=l.y)
then begin
writeln(fo,0.000:0:3);
close(fo);
halt;
end;
min:=INF;
for i:=1 to n do
begin
if dist(a[i],l)<min
then min:=dist(a[i],l);
if dist2(a[i],a[i+1],l)<min
then min:=dist2(a[i],a[i+1],l);
end;
if (min-r>0.0000)
then writeln(fo,min-r:0:3)
else writeln(fo,0.000:0:3);
close(fo);
end.