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;
struct Point {
  long double x, y;
  Point() {}
};
struct Circle {
  Circle() {}
  Point center;
  long double r;
} first_c, second_c;
long double computeDistance(Point A, Point B) {
  return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
}
long double computeSectorArcArea(long double r, long double angle) {
  return r * r * angle;
}
long double computeTriangleAngle(long double a, long double b, long double c) {
  long double angle = acos((b * b + c * c - a * a) / (2 * b * c));
  return angle;
}
int main() {
  cin >> first_c.center.x >> first_c.center.y >> first_c.r;
  cin >> second_c.center.x >> second_c.center.y >> second_c.r;
  long double centerLineLength =
      computeDistance(first_c.center, second_c.center);
  long double ans = 0.0;
  cout << fixed << setprecision(20);
  if (first_c.r + second_c.r - centerLineLength > 0) {
    if (abs(first_c.r - second_c.r) >= centerLineLength) {
      ans = min(
          first_c.r * first_c.r * 3.141592653589793238462643383279502884L,
          second_c.r * second_c.r * 3.141592653589793238462643383279502884L);
    } else {
      long double firstCircleAngle =
          computeTriangleAngle(second_c.r, first_c.r, centerLineLength);
      long double secondCircleAngle =
          computeTriangleAngle(first_c.r, second_c.r, centerLineLength);
      long double triangleArea = sin(firstCircleAngle) * cos(firstCircleAngle) *
                                     first_c.r * first_c.r +
                                 sin(secondCircleAngle) *
                                     cos(secondCircleAngle) * second_c.r *
                                     second_c.r;
      long double first_c_sectorArea =
          computeSectorArcArea(first_c.r, firstCircleAngle);
      long double second_c_sectorArea =
          computeSectorArcArea(second_c.r, secondCircleAngle);
      ans = second_c_sectorArea + first_c_sectorArea - triangleArea;
    }
  }
  cout << ans << endl;
  return 0;
}