struct point{ ll x,y; point operator + (const point &k1) const{return (point){k1.x+x,k1.y+y};} point operator - (const point &k1) const{return (point){x-k1.x,y-k1.y};} }; ll cross(point k1,point k2){return k1.x*k2.y-k1.y*k2.x;} point q[N]; int head,tail; void pop(ll k){ while(tail>head && q[head+1].y-q[head].y<=k*(q[head+1].x-q[head].x)) head++; } void push(point k1){ while(tail>head && cross(q[tail]-k1,q[tail-1]-k1)>=0)tail--; q[++tail]=k1; }