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 pi = 3.1415926535897932384626433832795;
struct point {
  long double x, y;
} A, B;
long double rA, rB, S, SA, SB, AB, AM, BM, alp;
int main() {
  cin >> A.x >> A.y >> rA;
  cin >> B.x >> B.y >> rB;
  SA = pi * rA * rA;
  SB = pi * rB * rB;
  AB = (A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y);
  if (AB <= (rA - rB) * (rA - rB)) {
    cout << setprecision(10) << fixed << min(SA, SB);
    return 0;
  }
  if (AB >= (rA + rB) * (rA + rB)) {
    cout << setprecision(10) << fixed << 0.0;
    return 0;
  }
  AB = sqrt(AB);
  AM = rA;
  BM = rB;
  alp = (AM * AM + AB * AB - BM * BM) / (AM * AB * 2.0);
  alp = acos(alp);
  S = sin(alp * 2.0) * AM * AM / 2.0;
  SA = (alp * SA) / pi;
  alp = (BM * BM + AB * AB - AM * AM) / (BM * AB * 2.0);
  alp = acos(alp);
  S = S + sin(alp * 2.0) * BM * BM / 2.0;
  SB = (alp * SB) / pi;
  cout << setprecision(10) << fixed << SA + SB - S;
}