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;
double CalcHalf(long long r1, long long r2, long long dx, long long dy) {
  long long l2 = dx * dx + dy * dy;
  double l = sqrt(static_cast<double>(l2));
  double x = static_cast<double>(r1 * r1 - r2 * r2 + l2) / (2.0 * l);
  double angle = 0.0;
  if (sqrt(2.0) * x < static_cast<double>(r1)) {
    angle = acos(x / r1);
  } else {
    double S = sqrt(static_cast<double>((r1 + r2) * (r1 + r2) - l2) *
                    static_cast<double>(l2 - (r1 - r2) * (r1 - r2))) /
               4.0;
    double y = 2.0 * S / l;
    if (y / r1 < 0.1) {
      double c[12] = {0,   0,           0,   1.0 / 6.0,     0.0, 3.0 / 40.0,
                      0.0, 5.0 / 112.0, 0.0, 35.0 / 1152.0, 0.0, 63.0 / 2816.0};
      double v[12] = {0};
      double vSin = 1.0;
      double sin2A = 2.0 * (y / r1) * (x / r1);
      for (size_t i = 0; i < 12; ++i) {
        v[i] = vSin * c[i];
        vSin *= sin2A;
      }
      double s = 0.0;
      for (int i = 11; i >= 0; --i) s += v[i];
      return static_cast<double>(r1 * r1) * s / 2.0;
    }
    angle = asin(y / r1);
  }
  return static_cast<double>(r1 * r1) * (2 * angle - sin(2 * angle)) / 2.0;
}
void SolveD() {
  long long x1, y1, r1;
  long long x2, y2, r2;
  cin >> x1 >> y1 >> r1;
  cin >> x2 >> y2 >> r2;
  x2 -= x1;
  y2 -= y1;
  x1 = y1 = 0;
  if ((r1 + r2) * (r1 + r2) <= x2 * x2 + y2 * y2) {
    cout << 0;
  } else if (x2 * x2 + y2 * y2 <= (r2 - r1) * (r2 - r1)) {
    double thePi = 3.14159265358979;
    cout << std::setprecision(17) << min(r1, r2) * thePi * min(r1, r2);
  } else {
    cout << std::setprecision(17)
         << CalcHalf(r1, r2, x2, y2) + CalcHalf(r2, r1, x2, y2);
  }
}
int main() {
  SolveD();
  return 0;
}