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 long double pi = acos(-1.0);
const long double eps = 1e-8;
int dblcmp(long double d) {
  if (fabs(d) < eps) return 0;
  return d > eps ? 1 : -1;
}
struct Vector {
  long double x, y;
  Vector() {}
  Vector(long double a, long double b) {
    x = a;
    y = b;
  }
  Vector operator+(Vector a) { return Vector(x + a.x, y + a.y); }
  Vector operator-(Vector a) { return Vector(x - a.x, y - a.y); }
  Vector operator*(long double t) { return Vector(x * t, y * t); }
  Vector operator/(long double t) { return Vector(x / t, y / t); }
  bool operator==(Vector a) {
    return (dblcmp(a.x - x) == 0 and dblcmp(a.y - y) == 0);
  }
  long double dot(Vector a) { return (x * a.x + y * a.y); }
  long double dist() { return sqrt(dot(*this)); }
};
struct Polygon {
  vector<Vector> P;
  long double polygonArea() {
    long double ret = 0.0;
    for (long long i = 0; i < P.size() - 1; i++) {
      ret += (P[i].x * P[i + 1].y - P[i].y * P[i + 1].x);
    }
    return fabs(ret) / 2.0;
  }
};
long double circleCircleArea(Vector a, long double r1, Vector b,
                             long double r2) {
  long double c = (a - b).dist();
  if (c >= (r1 + r2)) return 0.0;
  if (c <= fabs(r1 - r2)) {
    if (r2 < r1) return pi * r2 * r2;
    return pi * r1 * r1;
  }
  long double ret = 0.0;
  long double t1 = 2.0 * (acos((r1 * r1 + c * c - r2 * r2) / (2.0 * r1 * c)));
  long double t2 = 2.0 * (acos((r2 * r2 + c * c - r1 * r1) / (2.0 * r2 * c)));
  ret += (0.5 * t1 * r1 * r1);
  ret += (0.5 * t2 * r2 * r2);
  ret -= (0.5 * r1 * r1 * sin(t1));
  ret -= (0.5 * r2 * r2 * sin(t2));
  return ret + eps;
}
int main() {
  Vector a, b;
  long double r1, r2;
  cin >> a.x >> a.y >> r1 >> b.x >> b.y >> r2;
  long double ans = circleCircleArea(a, r1, b, r2);
  cout << setprecision(25) << ans << endl;
  return 0;
}