program route; var x,y:real; i,c:integer; ch1,ch2,ch3:char; s:string[255]; b:boolean; begin x:=0; y:=0; read(ch1); s:=ch1; if ch1<>"E" then begin repeat read(ch1); val(ch1,i,c); if c=0 then s:=s+ch1; until c<>0; val(s,i,c); end else i:=0; repeat read(ch2); b:=true; if ch2=',' then b:=false; if ch2='.' then b:=false; if b then begin read(ch3); if ch1='N' then if ch2='E' then begin x:=x+sqrt(sqr(i)/2); y:=y+sqrt(sqr(i)/2); end else begin x:=x-sqrt(sqr(i)/2); y:=y+sqrt(sqr(i)/2); end else if ch2='E' then begin x:=x+sqrt(sqr(i)/2); y:=y-sqrt(sqr(i)/2); end else begin x:=x-sqrt(sqr(i)/2); y:=y-sqrt(sqr(i)/2); end; if ch3='.' then begin if x>-0.001 then x:=abs(x); if y>-0.001 then y:=abs(y); writeln('You can go to (',x:1:3,',',y:1:3,'), the distance is ',sqrt(sqr(x)+sqr(y)):1:3,' steps.'); x:=0; y:=0; end; end else begin if ch1='N' then y:=y+i; if ch1='E' then x:=x+i; if ch1='S' then y:=y-i; if ch1='W' then x:=x-i; if ch2='.' then begin if x>-0.001 then x:=abs(x); if y>-0.001 then y:=abs(y); writeln('You can go to (',x:1:3,',',y:1:3,'), the distance is ',sqrt(sqr(x)+sqr(y)):1:3,' steps.'); x:=0; y:=0; end; end; read(ch1); s:=ch1; if ch1<>"E" then begin repeat read(ch1); val(ch1,i,c); if c=0 then s:=s+ch1; until c<>0; val(s,i,c); end else i:=0; until i=0; if x>-0.001 then x:=abs(x); if y>-0.001 then y:=abs(y); writeln('You can go to (',x:1:3,',',y:1:3,'), the distance is ',sqrt(sqr(x)+sqr(y)):1:3,' steps.'); end.