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;
long double PI = 3.14159265358979323846;
struct point {
  long double x, y;
};
struct circle {
  point p;
  long double r;
};
long double dist(point a, point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
int main() {
  long double x1, y1, r1, x2, y2, r2;
  cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
  point p1 = {x1, y1};
  point p2 = {x2, y2};
  circle c[3];
  c[1] = {p1, r1};
  c[2] = {p2, r2};
  if (dist(c[1].p, c[2].p) >= (r1 + r2)) {
    cout << 0 << endl;
    return 0;
  }
  if (dist(c[1].p, c[2].p) <= abs(r1 - r2)) {
    long double ans = PI * min(c[1].r, c[2].r) * min(c[1].r, c[2].r);
    cout.precision(12);
    cout << fixed << ans << endl;
    return 0;
  }
  long double final = 0.0;
  long double temp = acos(((c[1].r) * (c[1].r) +
                           (dist(c[1].p, c[2].p) * dist(c[1].p, c[2].p)) -
                           (c[2].r) * (c[2].r)) /
                          (long double)(2LL * (dist(c[1].p, c[2].p) * c[1].r)));
  long double a1 = temp * (long double)c[1].r * (long double)c[1].r;
  long double a2 = c[1].r * c[1].r * sin(temp) * cos(temp);
  final += a1 - a2;
  temp = acos(((c[2].r) * (c[2].r) +
               (dist(c[1].p, c[2].p) * dist(c[1].p, c[2].p)) -
               (c[1].r) * (c[1].r)) /
              (long double)(2LL * (dist(c[1].p, c[2].p) * c[2].r)));
  a1 = temp * (long double)c[2].r * c[2].r;
  a2 = c[2].r * c[2].r * sin(temp) * cos(temp);
  final += a1 - a2;
  cout.precision(12);
  cout << fixed << final << endl;
}