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;
mt19937_64 rang(
    chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
  uniform_int_distribution<int> uid(0, lim - 1);
  return uid(rang);
}
long long INF = 1e18 + 5;
const long long M = 1000000007;
long long powm(long long, long long, long long);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long double pi = acos(-1.0);
  long double x1, y1, r1, x2, y2, r2;
  cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
  long double dis = sqrtl(((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2)));
  long double del = abs(r1 - r2);
  if (dis - del <= 1e-9) {
    cout << setprecision(20) << pi * min(r1 * r1, r2 * r2);
    return 0;
  }
  if (dis - (r1 + r2) >= -1e-9) {
    cout << 0;
    return 0;
  }
  long double ar1 = pi * r1 * r1;
  long double ar2 = pi * r2 * r2;
  long double num1 = r1 * r1 + dis * dis - r2 * r2;
  long double den1 = 2 * r1 * dis;
  long double num2 = r2 * r2 + dis * dis - r1 * r1;
  long double den2 = 2 * r2 * dis;
  bool flag1 = 1, flag2 = 1;
  long double angle1 = min(2 * pi - acos(num1 / den1), acos(num1 / den1));
  long double angle2 = min(2 * pi - acos(num2 / den2), acos(num2 / den2));
  if (angle1 > pi / 2) flag1 = 0;
  if (angle2 > pi / 2) flag2 = 0;
  angle1 *= 2;
  angle2 *= 2;
  long double artr1 = 0.5 * r1 * r1 * sin(angle1);
  long double artr2 = 0.5 * r2 * r2 * sin(angle2);
  ar1 *= (angle1) / (2 * pi);
  ar2 *= (angle2) / (2 * pi);
  long double ans = 0;
  ans = ar1 + ar2 - artr1 - artr2;
  cout << setprecision(20) << ans << endl;
}
long long powm(long long a, long long b, long long c) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % c;
    a = (a * a) % c;
    b >>= 1;
  }
  return res;
}