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 long double eps = 1e-8;
const long double pi = acos(-1);
inline int sign(long double a) { return a < -eps ? -1 : a > eps; }
inline int cmp(long double a, long double b) { return sign(a - b); }
long double add(long double a, long double b) {
  if (abs(a + b) < eps * (abs(a) + abs(b))) return 0;
  return a + b;
}
struct P {
  long double x, y;
  P() {}
  P(long double x, long double y) : x(x), y(y) {}
  P operator+(const P &p) { return P(x + p.x, y + p.y); }
  P operator-(const P &p) { return P(x - p.x, y - p.y); }
  P operator*(long double d) { return P(x * d, y * d); }
  P operator/(long double d) { return P(x / d, y / d); }
  bool operator==(const P &p) { return cmp(x, p.x) == 0 && cmp(y, p.y) == 0; }
  long double dot(const P &p) { return x * p.x + y * p.y; }
  long double det(const P &p) { return x * p.y - y * p.x; }
  long double disto(const P &p) { return (*this - p).abs(); }
  long double alpha() { return atan2(y, x); }
  long double abs() { return sqrt(abs2()); }
  long double abs2() { return x * x + y * y; }
  P rot90() { return P(-y, x); }
  P unit() { return *this / abs(); }
  bool operator<(P p) const {
    int c = cmp(x, p.x);
    if (c) return c == -1;
    return cmp(y, p.y) == -1;
  }
  friend istream &operator>>(istream &in, P &p) {
    in >> p.x >> p.y;
    return in;
  }
  friend ostream &operator<<(ostream &out, P &p) {
    out << p.x << ' ' << p.y;
    return out;
  }
};
long double angle(P p1, P p2) { return acos(p1.dot(p2) / p1.abs() / p2.abs()); }
int circle_intersect(P o1, long double r1, P o2, long double r2) {
  long double d = (o1 - o2).abs2();
  if (cmp(d, (r1 + r2) * (r1 + r2)) == 1) return 4;
  if (cmp(d, (r1 + r2) * (r1 + r2)) == 0) return 3;
  if (cmp(d, abs(r1 - r2) * abs(r1 - r2)) == 1) return 2;
  if (cmp(d, abs(r1 - r2) * abs(r1 - r2)) == 0) return 1;
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  P o1, o2;
  long double r1, r2;
  cin >> o1 >> r1;
  cin >> o2 >> r2;
  int x = circle_intersect(o1, r1, o2, r2);
  if (x >= 3) {
    cout << 0.0 << '\n';
  } else if (x <= 1) {
    cout << min(r1, r2) * min(r1, r2) * pi << '\n';
  } else {
    long double d = o1.disto(o2);
    long double a = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));
    long double b = acos((r1 * r1 + d * d - r2 * r2) / (2 * r1 * d));
    long double ans = a * r2 * r2 - r2 * r2 * sin(2 * a) / 2 + b * r1 * r1 -
                      r1 * r1 * sin(2 * b) / 2;
    cout << ans << '\n';
  }
  return 0;
}