#include #include #include #include #include using namespace std; const double eps=1e-8; const int maxn = 505; struct point{ double x,y; }; struct ploy{ point node[ maxn ]; int n; }; point left,right,s; ploy p,p1,p2; double cross( point a,point b,point c ){ return (b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x); } double ploy_area( ploy res ){ double ans=0; res.node[ res.n ]=res.node[0]; for( int i=0;ieps?1:0;} ploy cut( ploy p,point s,point e ){ point tmp; ploy bb; int cnt=0; for( int i=0;i=0 ){ bb.node[ cnt ]=p.node[ i ]; cnt++; } if( d1*d2<0 ){ tmp.x=(s2*p.node[i].x-s1*p.node[i+1].x)/(s2-s1); tmp.y=(s2*p.node[i].y-s1*p.node[i+1].y)/(s2-s1); bb.node[ cnt ]=tmp; cnt++; } } bb.n=cnt; bb.node[ cnt ]=bb.node[ 0 ]; return bb; } int main(){ while( scanf("%d",&p.n),p.n ){ for( int i=0;ires2?res1:res2,res1>res2?res2:res1); } return 0; }