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 int N = 1e5 + 10;
const int SQRTN = 320;
const int LOGN = 20;
const double PI = acos(-1);
pair<long double, pair<long double, long double> > p1, p2;
long double d, ans, alfa, theta, t1, t2, t3, t4;
long double dist(pair<long double, long double> a,
                 pair<long double, long double> b) {
  return sqrt(
      (long double)((1ll * (a.first - b.first) * (a.first - b.first)) +
                    (1ll * (a.second - b.second) * (a.second - b.second))));
}
long long dist2(pair<long double, long double> a,
                pair<long double, long double> b) {
  return ((long long)((1ll * (a.first - b.first) * (a.first - b.first)) +
                      (1ll * (a.second - b.second) * (a.second - b.second))));
}
int main() {
  cin >> p1.second.first >> p1.second.second >> p1.first;
  cin >> p2.second.first >> p2.second.second >> p2.first;
  d = dist(p1.second, p2.second);
  if (dist2(p1.second, p2.second) >=
      (p1.first + p2.first) * (p1.first + p2.first))
    return cout << "0.00000" << endl, 0;
  if (p1.first > p2.first) swap(p1, p2);
  if (abs(d + p1.first - p2.first) < 0.00000001 || d + p1.first < p2.first) {
    ans = p1.first * p1.first * PI;
    cout.precision(19);
    cout << ans << endl;
    return 0;
  }
  alfa = 2 * asin(p2.first / d);
  alfa = 2 * acos((p1.first * p1.first - p2.first * p2.first + d * d) /
                  (2 * p1.first * d));
  theta = 2 * acos((p2.first * p2.first - p1.first * p1.first + d * d) /
                   (2 * p2.first * d));
  ans = 0.5 * (p1.first * p1.first) * alfa;
  ans += 0.5 * (p2.first * p2.first) * theta;
  alfa *= 0.5;
  theta *= 0.5;
  t1 = sin(alfa) * p1.first;
  t2 = cos(alfa) * p1.first;
  t3 = sin(theta) * p2.first;
  t4 = cos(theta) * p2.first;
  ans -= t1 * t2;
  ans -= t3 * t4;
  cout.precision(19);
  cout << ans << endl;
}