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 long xx1, yy1, r1, xx2, yy2, r2;
bool check() {
  long long rr = (r1 - r2) * (r1 - r2), rr2 = (r1 + r2) * (r1 + r2);
  long long xx = (xx1 - xx2) * (xx1 - xx2) + (yy1 - yy2) * (yy1 - yy2);
  return (rr < xx) && (xx <= rr2);
}
int main(int argc, char const* argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> xx1 >> yy1 >> r1 >> xx2 >> yy2 >> r2;
  if (check()) {
    long double R, r;
    long double rr0 = (long double)r1 * r1;
    long double rr1 = (long double)r2 * r2;
    long double d = sqrt(
        (long double)((xx2 - xx1) * (xx2 - xx1) + (yy2 - yy1) * (yy2 - yy1)));
    long double dd = (xx2 - xx1) * (xx2 - xx1) + (yy2 - yy1) * (yy2 - yy1);
    long double phi =
        (acos((rr0 + dd - rr1) / ((long double)2.0 * r1 * d))) * 2.0;
    long double theta =
        (acos((rr1 + dd - rr0) / ((long double)2.0 * r2 * d))) * 2.0;
    long double area1 =
        (long double)0.5 * theta * rr1 - (long double)0.5 * rr1 * sin(theta);
    long double area2 =
        (long double)0.5 * phi * rr0 - (long double)0.5 * rr0 * sin(phi);
    long double A = area1 + area2;
    if (isnan(A))
      cout << "0.00000000000000000000\n";
    else
      cout << fixed << setprecision(20) << A << endl;
  } else {
    long long rr = (r1 - r2) * (r1 - r2), rr2 = (r1 + r2) * (r1 + r2);
    long long xx = (xx1 - xx2) * (xx1 - xx2) + (yy1 - yy2) * (yy1 - yy2);
    if (xx <= rr) {
      if (r1 < r2)
        cout << fixed << setprecision(20) << acos(-1) * r1 * r1 << endl;
      else
        cout << fixed << setprecision(20) << acos(-1) * r2 * r2 << endl;
    } else
      cout << "0.00000000000000000000\n";
  }
  return 0;
}