#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <cstdio>
#include <string>
#include <cctype>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define LL long long
#define lson l, m, rt<<1
#define rson m+1, r, rt<<1|1
#define PI 3.1415926535897932626
#define EXIT exit(0);
#define DEBUG puts("Here is a BUG");
#define CLEAR(name, init) memset(name, init, sizeof(name))
const double eps = 1e-6;
const int MAXN = (int)1e9 + 5;
#define Vector Point
int dcmp(double x)
{
return fabs(x) < eps ? 0 : (x < 0 ? -1 : 1);
}
struct Point
{
double x, y;
int flag;
Point(const Point& rhs): x(rhs.x), y(rhs.y) { }
Point(double x = 0.0, double y = 0.0, int flag = -1): x(x), y(y), flag(flag) {}
friend istream& operator >> (istream& in, Point& P) { return in >> P.x >> P.y; }
friend ostream& operator << (ostream& out, const Point& P) { return out << P.x << ' ' << P.y; }
friend Vector operator + (const Vector& A, const Vector& B)
{
return Vector(A.x + B.x, A.y + B.y);
}
friend Vector operator - (const Point& A, const Point& B)
{
return Vector(A.x - B.x, A.y - B.y);
}
friend Vector operator * (const Vector& A, const double& p)
{
return Vector(A.x * p, A.y * p);
}
friend Vector operator / (const Vector& A, const double& p)
{
return Vector(A.x / p, A.y / p);
}
friend bool operator == (const Point& A, const Point& B)
{
return dcmp(A.x - B.x) == 0 && dcmp(A.y - B.y) == 0;
}
friend bool operator < (const Point& A, const Point& B)
{
return A.x < B.x || (A.x == B.x && A.y < B.y);
}
void in(void)
{
scanf("%lf%lf", &x, &y);
}
void out(void)
{
printf("%lf %lf", x, y);
}
};
struct Line
{
Point P;
Vector dir;
double ang;
Line() {}
Line(const Line& L): P(L.P), dir(L.dir), ang(L.ang) { }
Line(const Point& P, const Vector& dir): P(P), dir(dir)
{
ang = atan2(dir.y, dir.x);
}
bool operator < (const Line& L) const
{
return ang < L.ang;
}
Point point(double t)
{
return P + dir * t;
}
};
typedef vector<Point> Polygon;
struct Circle
{
Point c;
double r;
Circle() { }
Circle(const Circle& rhs): c(rhs.c), r(rhs.r) { }
Circle(const Point& c, const double& r): c(c), r(r) { }
Point point(double ang)
{
return Point(c.x + cos(ang) * r, c.y + sin(ang) * r);
}
};
double Dot(const Vector& A, const Vector& B)
{
return A.x * B.x + A.y * B.y;
}
double Length(const Vector& A)
{
return sqrt(Dot(A, A) + eps);
}
double juli(Point A, Point B)
{
return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
}
double Angle(const Vector& A, const Vector& B)
{
return acos(Dot(A, B) / Length(A) / Length(B));
}
double Cross(const Vector& A, const Vector& B)
{
return A.x * B.y - A.y * B.x;
}
double Area(const Point& A, const Point& B, const Point& C)
{
return fabs(Cross(B - A, C - A));
}
bool check_length(double a, double b, double c)
{
return dcmp(a + b - c) > 0 && dcmp(fabs(a - b) - c) < 0;
}
bool isTriangle(double a, double b, double c)
{
return check_length(a, b, c) && check_length(a, c, b) && check_length(b, c, a);
}
Vector Rotate(const Vector& A, const double& rad)
{
return Vector(A.x * cos(rad) - A.y * sin(rad), A.x * sin(rad) + A.y * cos(rad));
}
Vector Normal(const Vector& A)
{
double len = Length(A);
return Vector(-A.y / len, A.x / len);
}
Point GetLineIntersection(const Line& A, const Line& B)
{
Vector u = A.P - B.P;
double t = Cross(B.dir, u) / Cross(A.dir, B.dir);
return A.P + A.dir * t;
}
double DistanceToLine(const Point& P, const Line& L)
{
Vector v1 = L.dir, v2 = P - L.P;
return fabs(Cross(v1, v2)) / Length(v1);
}
double DistanceToSegment(const Point& P, const Point& A, const Point& B)
{
if (A == B) return Length(P - A);
Vector v1 = B - A, v2 = P - A, v3 = P - B;
if (dcmp(Dot(v1, v2)) < 0) return Length(v2);
if (dcmp(Dot(v1, v3)) > 0) return Length(v3);
return fabs(Cross(v1, v2)) / Length(v1);
}
Point GetLineProjection(const Point& P, const Line& L)
{
return L.P + L.dir * (Dot(L.dir, P - L.P) / Dot(L.dir, L.dir));
}
bool isOnSegment(const Point& P, const Point& A, const Point& B)
{
return dcmp(Cross(A - P, B - P)) == 0 && dcmp(Dot(A - P, B - P)) < 0;
}
bool specialOnSegment(const Point& P, const Point& A, const Point& B)
{
if (P == A || P == B) return true;
return dcmp(Cross(A - P, B - P)) == 0 && dcmp(Dot(A - P, B - P)) < 0;
}
bool SegmentProperIntersection(const Point& a1, const Point& a2, const Point& b1, const Point& b2)
{
double c1 = Cross(a2 - a1, b1 - a1), c2 = Cross(a2 - a1, b2 - a1);
double c3 = Cross(b2 - b1, a1 - b1), c4 = Cross(b2 - b1, a2 - b1);
return dcmp(c1) * dcmp(c2) < 0 && dcmp(c3) * dcmp(c4) < 0;
}
double PolygonArea(Polygon po)
{
int n = po.size();
double area = 0.0;
for (int i = 1; i < n - 1; i++)
{
area += Cross(po[i] - po[0], po[i + 1] - po[0]);
}
return area * 0.5;
}
int GetLineCircleIntersection(Line& L, const Circle& C)
{
double t1, t2;
double a = L.dir.x, b = L.P.x - C.c.x, c = L.dir.y, d = L.P.y - C.c.y;
double e = a * a + c * c, f = 2.0 * (a * b + c * d), g = b * b + d * d - C.r * C.r;
double delta = f * f - 4 * e * g;
if (dcmp(delta) < 0) return 0;
if (dcmp(delta) == 0)
{
t1 = t2 = -f / (2 * e);
sol.push_back(L.point(t1));
return 1;
}
t1 = (-f - sqrt(delta)) / (2.0 * e);
sol.push_back(L.point(t1));
t2 = (-f + sqrt(delta)) / (2.0 * e);
sol.push_back(L.point(t2));
return 2;
}
Polygon ConvexHull(vector<Point> p)
{
sort(p.begin(), p.end());
p.erase(unique(p.begin(), p.end()), p.end());
int n = p.size(), m = 0;
Polygon res(n + 1);
for (int i = 0; i < n; i++)
{
while (m > 1 && Cross(res[m - 1] - res[m - 2], p[i] - res[m - 2]) <= 0) m--;
res[m++] = p[i];
}
int k = m;
for (int i = n - 2; i >= 0; i--)
{
while (m > k && Cross(res[m - 1] - res[m - 2], p[i] - res[m - 2]) <= 0) m--;
res[m++] = p[i];
}
m -= n > 1;
res.resize(m);
return res;
}
bool isOnLeft(const Line& L, const Point& P)
{
return Cross(L.dir, P - L.P) > 0;
}
Polygon HalfPlaneIntersection(vector<Line> L)
{
int n = L.size();
int head, rear;
vector<Point> p(n);
vector<Line> q(n);
Polygon ans;
sort(L.begin(), L.end());
q[head = rear = 0] = L[0];
for (int i = 1; i < n; i++)
{
while (head < rear && !isOnLeft(L[i], p[rear - 1])) rear--;
while (head < rear && !isOnLeft(L[i], p[head])) head++;
q[++rear] = L[i];
if (fabs(Cross(q[rear].dir, q[rear - 1].dir)) < eps)
{
rear--;
if (isOnLeft(q[rear], L[i].P)) q[rear] = L[i];
}
if (head < rear) p[rear - 1] = GetLineIntersection(q[rear - 1], q[rear]);
}
while (head < rear && !isOnLeft(q[head], p[rear - 1])) rear--;
if (rear - head <= 1)
return ans;
p[rear] = GetLineIntersection(q[rear], q[head]);
for (int i = head; i <= rear; i++)
{
ans.push_back(p[i]);
}
return ans;
}
double calc(double r1, double r2, double d) {
double alpha = acos((r2*r2+d*d-r1*r1)/2/r2/d)*2;
double sector = alpha * r2 * r2 / 2;
double triangle = r2 * r2 * sin(alpha) / 2;
return sector - triangle;
}
double AreaofCircle(double x1, double y1, double r1, double x2, double y2, double r2)
{
double d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
if(d <= max(r1, r2) - min(r1, r2) + eps)
return acos(-1.0) * min(r1, r2) * min(r1, r2);
else if (d + eps >= r1 + r2)
return 0.000;
else
return calc(r1, r2, d) + calc(r2, r1, d);
}
int main(int argc, char const *argv[])
{
return 0;
}