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 long double PI = acos(-1), EPS = 1e-6;
struct Point {
  long double x, y;
  void read() { scanf("%Lf%Lf", &x, &y); }
};
long double sqr(const long double &x) { return x * x; }
int sgn(const long double &x) {
  if (abs(x) < EPS) return 0;
  return x < 0 ? -1 : 1;
}
int main() {
  Point c1, c2;
  long double r1, r2;
  c1.read();
  scanf("%Lf", &r1);
  c2.read();
  scanf("%Lf", &r2);
  long double d = sqrt(sqr(c1.x - c2.x) + sqr(c1.y - c2.y));
  if (sgn(r1 + r2 - d) <= 0)
    printf("0");
  else if (sgn(d - abs(r1 - r2)) <= 0) {
    long double r = min(r1, r2);
    printf("%.9Lf", r * r * PI);
  } else {
    long double ret = 0;
    for (int t = 0; t < 2; t++) {
      long double p = (r1 * r1 + d * d - r2 * r2) / (2 * r1 * d);
      long double da = acos(p) * 2;
      ret += r1 * r1 * (da - sin(da)) / 2;
      swap(r1, r2);
    }
    printf("%.9Lf", ret);
  }
  return 0;
}