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 maxn = 1e5 + 10;
const int maxm = 1e5 + 10;
const int INF = 0x3f3f3f3f;
const long double pai = acos(-1.0);
struct Circle {
  long double x, y, r;
};
long double Pow2(long double k) { return k * k; }
long double Dis(Circle a, Circle b) {
  return sqrt(Pow2(a.x - b.x) + Pow2(a.y - b.y));
}
int main() {
  Circle c1, c2;
  while (cin >> c1.x >> c1.y >> c1.r >> c2.x >> c2.y >> c2.r) {
    long double d = Dis(c1, c2);
    if (c1.r + c2.r <= d)
      printf("%.20f\n", double(0));
    else if (d + c1.r <= c2.r || d + c2.r <= c1.r) {
      long double R = min(c1.r, c2.r);
      printf("%.20f\n", double(R * R * pai));
    } else {
      long double ta = acos((Pow2(c1.r) + Pow2(d) - Pow2(c2.r)) / 2 / c1.r / d);
      long double tb = acos((Pow2(c2.r) + Pow2(d) - Pow2(c1.r)) / 2 / c2.r / d);
      long double area = ta * c1.r * c1.r - 0.5 * c1.r * c1.r * sin(ta * 2);
      area += tb * c2.r * c2.r - 0.5 * c2.r * c2.r * sin(tb * 2);
      printf("%.20f\n", double(area));
    }
  }
  return 0;
}