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 x1, x2, yy1, yy2, r1, r2, p, s, s1, s2, s3, s4, s5, h, a1, a2;
const double eps = 1e-8;
const double PI = acos(-1.0);
long double dis(long double x1, long double y1, long double x2,
                long double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
inline int dcmp(double x) {
  if (fabs(x) < eps)
    return 0;
  else
    return x < 0 ? -1 : 1;
}
int main() {
  scanf("%Lf%Lf%Lf%Lf%Lf%Lf", &x1, &yy1, &r1, &x2, &yy2, &r2);
  if (dcmp(dis(x1, yy1, x2, yy2) - r1 - r2) >= 0) {
    s = 0;
  } else if (dcmp(dis(x1, yy1, x2, yy2) + min(r1, r2) - max(r1, r2)) <= 0) {
    s = min(r1, r2) * min(r1, r2) * PI;
  } else {
    a1 = acos((r2 * r2 + ((x1 - x2) * (x1 - x2) + (yy1 - yy2) * (yy1 - yy2)) -
               r1 * r1) /
              (2 * r2 * dis(x1, yy1, x2, yy2)));
    s1 = r2 * cos(a1) * r2 * sin(a1);
    s2 = r2 * r2 * a1;
    a2 = acos((r1 * r1 + ((x1 - x2) * (x1 - x2) + (yy1 - yy2) * (yy1 - yy2)) -
               r2 * r2) /
              (2 * r1 * dis(x1, yy1, x2, yy2)));
    s3 = r1 * cos(a2) * r1 * sin(a2);
    s4 = r1 * r1 * a2;
    s = s2 + s4 - s1 - s3;
  }
  printf("%.10Lf\n", s);
}