uses crt; type kor=record x,y:integer; end; var i,n:integer; p:real; r,m:array[1..100] of kor; f:text; k,l,k1,k2,l1,l2:integer; function fl(x1,y1,x2,y2:integer):boolean; var xx,yy:real; begin fl:=true; if x1<>x2 then for i:=k1 to k2 do if m[i].y>(m[i].x-x1)*(y2-y1)/(x2-x1)+y1 then fl:=false; {(y-y1)/(y2-y1)=(x-x1)/(x2-x1) y=(x-x1)*(y2-y1)/(x2-x1)+y1 } end; function fr(x1,y1,x2,y2:integer):boolean; var xx,yy:real; begin fr:=true; if x1<>x2 then for i:=l1 to l2 do if m[i].y<(m[i].x-x1)*(y2-y1)/(x2-x1)+y1 then fr:=false; end; procedure sort; var temp,nm,max,k:integer; begin k:=n; while k>1 do begin max:=m[1].x;nm:=1; for i:=2 to k do if m[i].x>max then begin nm:=i; max:=m[i].x;end; temp:=m[nm].x;m[nm].x:=m[k].x;m[k].x:=temp; temp:=m[nm].y;m[nm].y:=m[k].y;m[k].y:=temp; k:=k-1; end; end; procedure out1; begin for i:=l to k do with r[i] do begin writeln(x,' ',y);end; end; begin clrscr; assign(f,'int.txt'); reset(f); readln(f,n); for i:=1 to n do with m[i] do readln(f,x,y); close(f); sort; k1:=1;k2:=n; k:=n; l1:=1;l2:=n; l:=n; r[k].x:=m[k1].x;r[k].y:=m[k1].y; while (k1<>k2) do begin if fl(m[k1].x,m[k1].y,m[k2].x,m[k2].y) then begin k:=k+1; r[k].x:=m[k2].x; r[k].y:=m[k2].y; k1:=k2;k2:=n; end else begin k2:=k2-1; end; end; while (l1<>l2) do begin if fr(m[l1].x,m[l1].y,m[l2].x,m[l2].y) then begin l:=l-1; r[l].x:=m[l2].x; r[l].y:=m[l2].y; l1:=l2;l2:=n; end else begin l2:=l2-1; end; end; P:=0; FOR i:=l to k-1 do p:=p+sqrt(sqr(r[i+1].x-r[i].x)+sqr(r[i+1].y-r[i].y)); out1; writeln('P=',p:5:3); end.