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;
class Circle {
 public:
  complex<long double> c;
  long double r;
  Circle() {}
  Circle(complex<long double> cc, long double rr) {
    c = cc;
    r = rr;
  }
};
long double add(long double a, long double b) {
  if (fabs(a + b) < 1e-9 * (fabs(a) + fabs(b))) return 0.0;
  return a + b;
}
long double solve(Circle c1, Circle c2) {
  long double d = abs(c1.c - c2.c);
  long double alpha =
      acos((c2.r * c2.r + d * d - c1.r * c1.r) / (2.0 * c2.r * d));
  long double s = alpha * c2.r * c2.r;
  long double t = c2.r * c2.r * sin(alpha) * cos(alpha);
  swap(c1, c2);
  d = abs(c1.c - c2.c);
  alpha = acos((c2.r * c2.r + d * d - c1.r * c1.r) / (2.0 * c2.r * d));
  s = add(s, alpha * c2.r * c2.r);
  t = add(t, c2.r * c2.r * sin(alpha) * cos(alpha));
  return s - t;
}
int main(void) {
  Circle a, b;
  long double x, y, r;
  cin >> x >> y >> r;
  a = Circle(complex<long double>(x, y), r);
  cin >> x >> y >> r;
  b = Circle(complex<long double>(x, y), r);
  long double d = abs(a.c - b.c);
  if (d + 1e-9 >= a.r + b.r)
    printf("0.0000000\n");
  else if (d <= max(add(a.r, -b.r), add(b.r, -a.r)) + 1e-9)
    printf("%.20f\n", (double)min(a.r * a.r * M_PI, b.r * b.r * M_PI));
  else {
    printf("%.20f\n", (double)solve(a, b));
  }
  return 0;
}