#include using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 2000000005 const double eps = 1e-10; template struct vector_2d{ T x,y,r,d; vector_2d(T a=0.0,T b=0.0){ x = a; y = b; fix_rd(); } void update_x(T a,T b){ x = a*x + b; fix_rd(); } void update_x(T a){ update_x(0.0,a); } void update_y(T a,T b){ y = a*y + b; fix_rd(); } void update_y(T a){ update_y(0.0,a); } void update_r(T a,T b){ r = a*r + b; fix_xy(); } void update_r(T a){ update_r(0.0,a); } void update_d(T a,T b){ d = a*d + b; fix_xy(); } void update_d(T a){ update_d(0.0,a); } void fix_xy(){ x = r * cos(d); y = r * sin(d); fix_rd(); } void fix_rd(){ r = hypot(x,y); if(r==0.0)d=0.0; else d = atan2(y,x); fix_zero(); } void fix_zero(){ if(abs(x) V){ return hypot(x-V.x,y-V.y); } T angle_difference(vector_2d V){ double ret = d - V.d; if(ret<-acos(-1.0))ret = acos(-1.0)*2.0+ret; if(ret>acos(-1.0))ret=-acos(-1.0)*2.0+ret; return ret; } //中点 vector_2d get_midpoint(vector_2d V){ V.update_x(0.5,x/2.0); V.update_y(0.5,y/2.0); return V; } T get_inner_product(vector_2d V){ return x*V.x+y*V.y; } T get_cross_product(vector_2d V){ return x*V.y-y*V.x; } vector_2d &operator+=(const vector_2d &another){ update_x(1,another.x); update_y(1,another.y); return (*this); } vector_2d &operator-=(const vector_2d &another){ update_x(1,-another.x); update_y(1,-another.y); return (*this); } vector_2d operator+(const vector_2d &another)const{ return (vector_2d(*this)+=another); } vector_2d operator-(const vector_2d &another)const{ return (vector_2d(*this)-=another); } void show(){ cout< struct line{ T a,b,c; line(T A,T B,T C){ a=A,b=B,c=C; } line(vector_2d V,T A,T B){ a = A; b = B; c = -a*V.x - b*V.y; } line(vector_2d V1=vector_2d(),vector_2d V2=vector_2d()):line(V1,-(V1.y-V2.y),V1.x-V2.x){ } void fix_abc(){ T l = hypot(a,b); a/=l;b/=l;c/=l; T X = a; if(abs(X) V){ return (a*V.x+b*V.y+c)/hypot(a,b); } T get_dis(vector_2d V){ return abs(get_signed_dis(V)); } vector_2d get_projection(vector_2d P){ line L(P,-b,a); return get_cross_point(L); } vector_2d get_cross_point(line L){ vector_2d ret(1e20,1e20); if(abs(L.a*b-a*L.b)>=eps){ ret.update_x((L.b*c-b*L.c)/(L.a*b-a*L.b)); ret.update_y((a*L.c-L.a*c)/(L.a*b-a*L.b)); } return ret; } void show(){ cout<>a>>b>>c>>d>>e>>f; line L0(a,b,-c),L1(d,e,-f); vector_2d ret = L0.get_cross_point(L1); cout<