Problem: You are given two circles. Find the area of their intersection.

Input

The first line contains three integers x1, y1, r1 ( - 109 ≤ x1, y1 ≤ 109, 1 ≤ r1 ≤ 109) — the position of the center and the radius of the first circle.

The second line contains three integers x2, y2, r2 ( - 109 ≤ x2, y2 ≤ 109, 1 ≤ r2 ≤ 109) — the position of the center and the radius of the second circle.

Output

Print the area of the intersection of the circles. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6.

Examples

Input

0 0 4
6 0 4


Output

7.25298806364175601379


Input

0 0 5
11 0 5


Output

0.00000000000000000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
void __print(long long x) { cout << x; }
void __print(long x) { cout << x; }
void __print(unsigned x) { cout << x; }
void __print(unsigned long x) { cout << x; }
void __print(unsigned long long x) { cout << x; }
void __print(float x) { cout << x; }
void __print(double x) { cout << x; }
void __print(long double x) { cout << x; }
void __print(char x) { cout << '\'' << x << '\''; }
void __print(const char *x) { cout << '\"' << x << '\"'; }
void __print(const string &x) { cout << '\"' << x << '\"'; }
void __print(bool x) { cout << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cout << '{';
  __print(x.first);
  cout << ',';
  __print(x.second);
  cout << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cout << '{';
  for (auto &i : x) cout << (f++ ? "," : ""), __print(i);
  cout << "}";
}
void _print() { cout << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cout << ", ";
  _print(v...);
}
const long long INF64 = 1e18;
const long long INF32 = 1e9;
const long long BIG = (long long)(1e9 + 239);
const long long MOD = 1000000007;
const double PI = 2.0 * acos(0.0);
const double EPS = static_cast<double>(1e-10);
const long long day[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const long long dx[4] = {0, 1, 0, -1};
const long long dy[4] = {1, 0, -1, 0};
mt19937 rnd(239);
typedef vector<vector<long long>> matrix;
void FILEIO() {
  freopen("in.txt", "r", stdin);
  freopen("out.txt", "w", stdout);
}
long long mostSignDigit(long long n) {
  double k = log10(n);
  return pow(10, k - floor(k));
}
long long numOfDigits(long long n) { return floor(log10(n)) + 1; }
bool isPowerOfTwo(long long x) { return x && (!(x & (x - 1))); }
bool allPositive(vector<long long> &a) {
  return all_of(begin(a), end(a), [](long long x) { return x > 0; });
}
bool anyPositive(vector<long long> &a) {
  return any_of(begin(a), end(a), [](long long x) { return x > 0; });
}
bool nonePositive(vector<long long> &a) {
  return none_of(begin(a), end(a), [](long long x) { return x > 0; });
}
const long double INF = 1e100;
struct Point {
  long double x, y;
  Point() : x(0), y(0) {}
  Point(long double x, long double y) : x(x), y(y) {}
  Point(const Point &p) : x(p.x), y(p.y) {}
  bool operator<(const Point &p) const {
    return make_pair(x, y) < make_pair(p.x, p.y);
  }
  bool operator==(const Point &p) const {
    return make_pair(x, y) == make_pair(p.x, p.y);
  }
  bool operator!=(const Point &p) const { return !(*this == p); }
  Point operator=(const Point &p) {
    x = p.x, y = p.y;
    return *this;
  }
  Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
  Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
  Point operator*(long double c) const { return Point(x * c, y * c); }
  Point operator/(long double c) const { return Point(x / c, y / c); }
};
long double cross(Point p, Point q) { return p.x * q.y - p.y * q.x; }
long double dot(Point p, Point q) { return p.x * q.x + p.y * q.y; }
long double Det(Point a, Point b, Point c) { return cross(b - a, c - a); }
long double dist(Point p, Point q) { return sqrt(dot(p - q, p - q)); }
long double dist2(Point p, Point q) { return dot(p - q, p - q); }
long double area(Point a, Point b, Point c) {
  return fabs(cross(b - a, c - a) / 2.0);
}
long double area2(Point a, Point b, Point c) {
  return fabs(cross(a, b) + cross(b, c) + cross(c, a)) / 2;
}
Point rotateCCW90(Point p) { return Point(-p.y, p.x); }
Point rotateCW90(Point p) { return Point(p.y, -p.x); }
Point rotateCCW(Point p, long double t) {
  return Point(p.x * cos(t) - p.y * sin(t), p.x * sin(t) + p.y * cos(t));
}
long long sign(long double x) {
  long long ans = x < -EPS ? -1 : (x > EPS);
  return ans;
}
ostream &operator<<(ostream &os, const Point &p) {
  os << "(" << p.x << "," << p.y << ")";
  return os;
}
Point projectPointLine(Point a, Point b, Point c) {
  return a + (b - a) * dot(c - a, b - a) / dot(b - a, b - a);
}
struct Circle {
  Point c;
  long double r;
};
struct Segment {
  Point a, b;
};
Segment circleCircleIntersection(Circle c1, Circle c2) {
  Segment s = {{INF, INF}, {INF, INF}};
  long double d = dist(c1.c, c2.c);
  if (d > c1.r + c2.r or d + min(c1.r, c2.r) < max(c1.r, c2.r)) return s;
  long double x = (d * d - c2.r * c2.r + c1.r * c1.r) / (2.0 * d),
              y = sqrt(c1.r * c1.r - x * x);
  Point v = (c2.c - c1.c) / d;
  s.a = c1.c + v * x + rotateCW90(v) * y;
  if (y > 0) s.b = c1.c + v * x - rotateCW90(v) * y;
  return s;
}
long double angle(Point a) {
  if (a.x == 0)
    if (a.y > 0)
      return PI / 2.0;
    else
      return 3.0 * PI / 2.0;
  if (a.y == 0)
    if (a.x > 0)
      return 0;
    else
      return PI;
  long double res = atan(a.y / a.x);
  if (a.x < 0) return res + PI;
  if (a.y < 0) return res + 2.0 * PI;
  return res;
}
long double angle(Point A, Point B) {
  long double d = dot(A, B), c = fabs(cross(A, B));
  return atan2(c, d);
}
void solve() {
  Circle a, b;
  cin >> a.c.x >> a.c.y >> a.r;
  cin >> b.c.x >> b.c.y >> b.r;
  long double d = dist(a.c, b.c);
  if (d >= a.r + b.r) {
    cout << setprecision(10) << fixed << 0 << endl;
    return;
  }
  if (d + min(a.r, b.r) <= max(a.r, b.r)) {
    cout << setprecision(10) << fixed << PI * min(a.r, b.r) * min(a.r, b.r)
         << endl;
    return;
  }
  long double angA = acos((a.r * a.r + d * d - b.r * b.r) / (2.0 * a.r * d));
  long double angB = acos((b.r * b.r + d * d - a.r * a.r) / (2.0 * b.r * d));
  long double SA = a.r * a.r * sin(2.0 * angA) / 2.0;
  long double SB = b.r * b.r * sin(2.0 * angB) / 2.0;
  long double S1, S2;
  S1 = angA * a.r * a.r - SA;
  S2 = angB * b.r * b.r - SB;
  cout << setprecision(10) << fixed << S1 + S2 << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  { solve(); }
  return 0;
}