typedef double db;
const db EPS = 1e-9;
inline int sign(db a){ return a < -EPS ? -1 : a > EPS;}
inline int cmp(db a,db b){return sign(a-b); }
struct P
{
db x,y;
P(){}
P(db _x,db _y):x(_x),y(_y){}
P operator+(P p) { return {x + p.x,y + p.y}; }
P operator-(P p) { return {x - p.x,y - p.y}; }
P operator*(db d) { return {x * d,y * d}; }
P operator/(db d) { return {x / d,y / d}; }
bool operator<(P p)const//先看第一维再看第二维
{
int c = cmp(x,p.x);
if(c)return c == -1;
return cmp(y,p.y) == -1;
}
bool operator==(P o)const
{
return cmp(x,o.x) == 0 && cmp(y,o.y) == 0;
}
};
db dot(P p) { return x*p.x + y*p.y; }//点积
db det(P p) { return x*p.y - y*p.x; }//叉积 p*q*sin p*q>0 q在p逆时针 p*q==0 共线 p*q<0 q在p顺时针,可以用(1,0),(0,1)来看
db distTo(P p){return (*this-p).abs();}
db alpha() {return atan2(y, x);}
void read() { cin>>x>>y; }
void write() { cout<<"("<<x<<","<<y<<")"<<endl;}
db abs2() { return x*x+y*y; }
db abs() { return sqrt(abs2()); }
P rot90() { return P(-y,x); }
P unit() { return *this/abs(); }
int quad() { return sign(y) == 1 || (sign(y) == 0 && sign(x) >= 0); }
极角排序 atan2