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;
inline double min(double a, double b) { return a < b ? a : b; }
double calcHalf(int64_t r1, int64_t r2, int64_t dx, int64_t dy) {
  int64_t l2 = dx * dx + dy * dy;
  double l = sqrt(l2);
  double x = (r1 * r1 - r2 * r2 + l2) / (2.0 * l);
  double angle = 0.0;
  if (sqrt(2.0) * x < 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 vSin = 1.0;
      double sin2A = 2.0 * (y / r1) * (x / r1);
      double s = 0.0;
      for (size_t i = 0; i < 12; ++i) {
        s += vSin * c[i];
        vSin *= sin2A;
      }
      return (r1 * r1) * s / 2.0;
    }
    angle = asin(y / r1);
  }
  return (r1 * r1) * (2 * angle - sin(2 * angle)) / 2.0;
}
int main() {
  int64_t x1, y1, r1;
  int64_t x2, y2, r2;
  cin >> x1 >> y1 >> r1;
  cin >> x2 >> y2 >> r2;
  int64_t d2 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
  if ((r1 + r2) * (r1 + r2) <= d2) {
    cout << "0.000000000" << endl;
    return 0;
  }
  if ((r1 - r2) * (r1 - r2) >= d2) {
    double s1 = M_PI * r1 * r1;
    double s2 = M_PI * r2 * r2;
    cout << setprecision(12) << min(s1, s2) << endl;
    return 0;
  }
  cout << setprecision(12)
       << calcHalf(r1, r2, x2 - x1, y2 - y1) +
              calcHalf(r2, r1, x2 - x1, y2 - y1)
       << endl;
  return 0;
}