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 double xa, ya, ra, xb, yb, rb, d;
long double h, alp, bet, s1, s2;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> xa >> ya >> ra;
  cin >> xb >> yb >> rb;
  d = (xa - xb) * (xa - xb) + (ya - yb) * (ya - yb);
  long double pi = acos(-1);
  if (d >= (ra + rb) * (ra + rb))
    cout << 0;
  else if (d <= (ra - rb) * (ra - rb)) {
    d = min(ra, rb);
    cout << fixed << setprecision(20) << d * d * pi;
  } else {
    h = (long double)sqrt(d);
    alp = 2.0 * acos((long double)(ra * ra + d - rb * rb) / (2.0 * ra * h));
    bet = 2.0 * acos((long double)(rb * rb + d - ra * ra) / (2.0 * rb * h));
    s1 = alp * ra * ra * 0.5 - ra * ra * sin(alp) * 0.5;
    s2 = bet * rb * rb * 0.5 - rb * rb * sin(bet) * 0.5;
    cout << fixed << setprecision(20) << s1 + s2;
  }
}