usingnamespace std; using longs = longlong; using uint = unsigned;
inlineintnextInt() { int x = 0, f = 1, ch = getchar(); while (!isdigit(ch)) if (ch == '-') f = -1, ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 48, ch = getchar(); return x * f; }
namespace Geo { using number = longdouble; const number eps = 1e-8;
intcompareTo(number x){return x < -eps ? -1 : x > eps;} intcompareTo(number a, number b){returncompareTo(a-b);}
point operator +(const point &rhs) const {return {x + rhs.x, y + rhs.y};} point operator -(const point &rhs) const {return {x - rhs.x, y - rhs.y};} number operator *(const point &rhs) const {return x * rhs.x + y * rhs.y;} point operator *(const number rhs) const {return {rhs * x, rhs * y};} point operator /(const number rhs) const {return {x / rhs, y / rhs};} point &operator +=(const point& rhs) {x += rhs.x; y += rhs.y; return *this;} point &operator -=(const point& rhs) {x -= rhs.x; y -= rhs.y; return *this;} point &operator *=(const number rhs) {x *= rhs; y *= rhs; return *this;} point &operator /=(const number rhs) {x /= rhs; y /= rhs; return *this;} booloperator ==(const point &rhs) const {return x == rhs.x && y == rhs.y;} booloperator !=(const point &rhs) const {return !(rhs == *this);}
number dot(const point &rhs)const{return x * rhs.x + y * rhs.y;} number cross(const point &rhs)const{return rhs.y * x - rhs.x * y;} autolength()const{returnsqrt(dot(*this));} autodistance(const point &b)const{return (*this - b).length();} autodistance(const point &ls, const point &rs)const {returnfabs((ls - *this).cross(rs - *this)) / ls.distance(rs);} point normal()const{return (x || y) ? *this / length() : point(0, 0);} autoangle()const{returnatan2(y, x);} point rotate(number a)const {number c = cos(a), s = sin(a); return {c * x - s * y, s * x + c * y};} point perpendicular()const{return {-y, x};} point symmetry()const{return {-x, -y};} number square()const{ return x * x + y * y; } };
structline { point s, t;
line() = default; line(number a, number b, number x, number y) : s(a, b), t(x, y) {} line(const point &s, const point &t) : s(s), t(t) {} };
intonLeft(point p, line l) { number xx = (l.t - l.s).cross(p - l.s); returncompareTo(xx); } }
using point = Geo::point; using number = Geo::number; using Geo::compareTo;