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 = acosl((long double)-1.0);
struct P {
  long double x, y;
  long double distTo(const P &that) {
    return sqrtl((x - that.x) * (x - that.x) + (y - that.y) * (y - that.y));
  }
};
struct C {
  P o;
  long double r;
  long double area() { return PI * r * r; }
  bool contains(const C &that) { return r >= o.distTo(that.o) + that.r; }
  bool intersects(const C &that) {
    long double a = r, b = that.r, c = o.distTo(that.o);
    return a + b > c && a + c > b && b + c > a;
  }
} a, b;
long double triangleArea(long double c, long double ang) {
  long double a = c * sinl(ang), b = c * cosl(ang);
  return a * b / 2;
}
long double sectorArea(long double r, long double ang) {
  return ang / 2 * r * r;
}
long double getAng(long double a, long double b, long double c) {
  long double cosAng = (c * c - a * a - b * b) / -(2 * a * b);
  return acosl(cosAng);
}
int main() {
  cin >> a.o.x >> a.o.y >> a.r;
  cin >> b.o.x >> b.o.y >> b.r;
  cout << fixed << setprecision(10);
  if (a.contains(b)) {
    cout << b.area();
    return 0;
  }
  if (b.contains(a)) {
    cout << a.area();
    return 0;
  }
  if (!a.intersects(b)) {
    cout << 0;
    return 0;
  }
  long double A = a.r;
  long double B = b.r;
  long double C = a.o.distTo(b.o);
  long double alpha = getAng(A, C, B);
  long double beta = getAng(B, C, A);
  long double res = 0;
  res += sectorArea(A, alpha) - triangleArea(A, alpha);
  res += sectorArea(B, beta) - triangleArea(B, beta);
  res *= 2;
  cout << res;
}