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 = 2005;
const int M = 1000005;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long fact(long long n) {
  long long ret = 1;
  for (int i = 1; i <= n; i++) ret *= i;
  return ret;
}
bool is_vowel(char c) {
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'y')
    return 1;
  return 0;
}
long double getDistance(long double x1, long double y1, long double x2,
                        long double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  long long x[2], y[2], r[2];
  for (int i = 0; i < 2; i++) cin >> x[i] >> y[i] >> r[i];
  if ((x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]) >=
      (r[0] + r[1]) * (r[0] + r[1]))
    cout << "0.0";
  else if ((x[0] - x[1]) * (x[0] - x[1]) + (y[0] - y[1]) * (y[0] - y[1]) <=
           abs(r[0] - r[1]) * abs(r[0] - r[1])) {
    cout << setprecision(9) << acos(-1) * pow(min(r[0] * 1.0, r[1] * 1.0), 2.0);
  } else {
    long double D = getDistance(x[0] * 1.0, y[0] * 1.0, x[1] * 1.0, y[1] * 1.0);
    long double theta1 = acos((r[0] * 1.0 * r[0] + D * D - r[1] * 1.0 * r[1]) /
                              (2.0 * r[0] * D));
    long double Area1 =
        theta1 * r[0] * r[0] * 1.0 - 0.5 * r[0] * r[0] * sin(theta1 * 2.0);
    long double theta2 = acos((r[1] * 1.0 * r[1] + D * D - r[0] * 1.0 * r[0]) /
                              (2.0 * r[1] * D));
    long double Area2 =
        theta2 * r[1] * r[1] * 1.0 - 0.5 * r[1] * r[1] * sin(theta2 * 2.0);
    cout << setprecision(9) << Area1 + Area2;
  }
  return 0;
}