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;
const int MAX_N = 2e5 + 10;
const int INF = 1e9;
const long double eps = 1e-8;
const long double PI =
    3.141592653589793238462643383279502884197169399375105820974944592307816406286;
bool is_zero(long double x) {
  if (abs(x) <= eps) return true;
  return false;
}
struct point {
 public:
  long double x, y;
  point() {}
  point(long double xx, long double yy) {
    x = xx;
    y = yy;
  }
};
long double distance(point me, point other) {
  long double ret =
      (other.x - me.x) * (other.x - me.x) + (other.y - me.y) * (other.y - me.y);
  return sqrt(ret);
}
struct circle {
 public:
  long double r;
  point center;
  circle(long double rr, long double x, long double y) {
    r = rr;
    center.x = x;
    center.y = y;
  }
  long double S() { return PI * r * r; }
  long double P() { return 2 * PI * r; }
  int is_inside(point other) {
    if (is_zero(distance(center, other) - r)) return 1;
    if (distance(center, other) <= r) return 2;
    return 0;
  }
  pair<int, vector<point> > intersect(circle other) {
    vector<point> v;
    long double sumr = other.r + r;
    long double rr = r - other.r;
    long double dis = distance(center, other.center);
    long double a = (r * r - other.r * other.r + dis * dis) / (2 * dis);
    long double h = sqrt(r * r - a * a);
    point p2(center.x, center.y);
    p2.x = a * (other.center.x - center.x) / dis;
    p2.y = a * (other.center.y - center.y) / dis;
    if (is_zero(sumr - dis)) {
      v.push_back(p2);
      return make_pair(3, v);
    }
    if (is_zero(rr - dis)) {
      v.push_back(p2);
      return make_pair(1, v);
    }
    if (dis <= rr) return make_pair(0, v);
    if (dis >= sumr) return make_pair(4, v);
    point p3(p2.x + h * (other.center.y - center.y) / dis,
             p2.y - h * (other.center.x - center.x) / dis);
    point p4(p2.x - h * (other.center.y - center.y) / dis,
             p2.y + h * (other.center.x - center.x) / dis);
    v.push_back(p3);
    v.push_back(p4);
    return make_pair(2, v);
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long double x1, y1, r1, x2, y2, r2;
  cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
  circle a(r1, x1, y1);
  circle b(r2, x2, y2);
  pair<int, vector<point> > x = a.intersect(b);
  pair<int, vector<point> > y = b.intersect(a);
  if (x.first == 0 || x.first == 1) {
    cout << fixed << setprecision(10) << b.S() << endl;
    return 0;
  }
  if (y.first == 0 || y.first == 1) {
    cout << fixed << setprecision(10) << a.S() << endl;
    return 0;
  }
  if (x.first == 3 || x.first == 4) {
    cout << fixed << setprecision(10) << 0 << endl;
    return 0;
  }
  long double dis = distance(a.center, b.center);
  long double alpha = acos((r2 * r2 + dis * dis - r1 * r1) / (2 * r2 * dis));
  long double s = alpha * r2 * r2;
  long double t = r2 * r2 * sin(alpha) * cos(alpha);
  long double ans = s - t;
  alpha = acos((r1 * r1 + dis * dis - r2 * r2) / (2 * r1 * dis));
  s = alpha * r1 * r1;
  t = r1 * r1 * sin(alpha) * cos(alpha);
  ans += s - t;
  cout << fixed << setprecision(10) << ans << endl;
}