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 double e = 0.000000001;
long long x, y, z, u, v, w;
int main() {
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d", &x, &y, &z, &u, &v, &w);
  long double xx = (long double)x;
  long double yy = (long double)y;
  long double zz = (long double)z;
  long double uu = (long double)u;
  long double vv = (long double)v;
  long double ww = (long double)w;
  long long b = (x - u) * (x - u) + (y - v) * (y - v);
  long double bb = sqrt((xx - uu) * (xx - uu) + (yy - vv) * (yy - vv));
  if (b >= (z + w) * (z + w))
    printf("0\n");
  else if ((w >= z) && ((w - z) * (w - z) >= b))
    printf("%0.9f\n", (double)(4 * atan(1) * zz * zz));
  else if ((z >= w) && ((z - w) * (z - w) >= b))
    printf("%0.9f\n", (double)(4 * atan(1) * ww * ww));
  else {
    long double alpha = acos((ww * ww + bb * bb - zz * zz) / (2 * ww * bb));
    long double s1 = alpha * ww * ww;
    long double t1 = ww * ww * sin(alpha) * cos(alpha);
    long double beta = acos((zz * zz + bb * bb - ww * ww) / (2 * zz * bb));
    long double s2 = beta * zz * zz;
    long double t2 = zz * zz * sin(beta) * cos(beta);
    printf("%0.9f\n", (double)(s1 - t1 + s2 - t2));
  }
  return 0;
}