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.0L);
typedef struct point {
  long double x, y;
  point() { x = y = 0.0L; }
  point(long double _x, long double _y) : x(_x), y(_y) {}
} point;
point toVec(point a, point b) { return point(b.x - a.x, b.y - a.y); }
point translate(point a, point v) { return point(a.x + v.x, a.y + v.y); }
point scale(point v, long double k) { return point(v.x * k, v.y * k); }
long double dist(point a, point b) { return hypot(a.x - b.x, a.y - b.y); }
int main() {
  cout.precision(20);
  cout << fixed;
  long double r1, r2;
  point a, b;
  cin >> a.x >> a.y >> r1;
  cin >> b.x >> b.y >> r2;
  long double area1, area2;
  area1 = PI * r1 * r1;
  area2 = PI * r2 * r2;
  if (dist(a, b) >= r1 + r2) {
    cout << 0.0L << endl;
    return 0;
  }
  if (dist(a, b) + min(r1, r2) <= max(r1, r2)) {
    cout << min(area1, area2) << endl;
    return 0;
  }
  if (abs(a.y - b.y) > abs(a.x - b.x)) {
    swap(a.x, a.y);
    swap(b.x, b.y);
  }
  if (a.x > b.x) {
    swap(a, b);
    swap(r1, r2);
    swap(area1, area2);
  }
  long double alpha1 = acos((r1 * r1 + dist(a, b) * dist(a, b) - r2 * r2) /
                            (2.0L * r1 * dist(a, b)));
  long double alpha2 = acos((r2 * r2 + dist(a, b) * dist(a, b) - r1 * r1) /
                            (2.0L * r2 * dist(a, b)));
  long double areasec1, areatri1, areasec2, areatri2;
  areasec1 = r1 * r1 * alpha1;
  areatri1 = r1 * r1 * sin(alpha1) * cos(alpha1);
  areasec2 = r2 * r2 * alpha2;
  areatri2 = r2 * r2 * sin(alpha2) * cos(alpha2);
  long double ans = (areasec1 + areasec2 - areatri1 - areatri2);
  cout << ans << endl;
}