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;
struct circle {
  long double x, y, r;
};
long double disn(circle a, circle b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
const long double eps = 1e-8;
const long double pi = acos(-1.0);
int dcmp(long double x) {
  if (fabs(x) <= eps) return 0;
  return x < 0 ? -1 : 1;
}
int main() {
  circle c1, c2;
  cin >> c1.x >> c1.y >> c1.r;
  cin >> c2.x >> c2.y >> c2.r;
  if (dcmp(c1.r - c2.r) > 0) swap(c1, c2);
  long double d = disn(c1, c2);
  long double ans = 0;
  if (dcmp(c1.r + d - c2.r) <= 0) {
    ans = pi * c1.r * c1.r;
    cout << setiosflags(ios::fixed) << setprecision(20) << ans << endl;
  } else if (dcmp(c1.r + c2.r - d) <= 0) {
    cout << 0 << endl;
  } else {
    long double ang1 =
        acos((c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d));
    long double ang2 =
        acos((c2.r * c2.r + d * d - c1.r * c1.r) / (2 * c2.r * d));
    long double area1 =
        ang1 * c1.r * c1.r - c1.r * sin(ang1) * c1.r * cos(ang1);
    long double area2 =
        ang2 * c2.r * c2.r - c2.r * sin(ang2) * c2.r * cos(ang2);
    long double ans = area1 + area2;
    cout << setiosflags(ios::fixed) << setprecision(20) << ans << endl;
  }
  return 0;
}