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;
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
using vi = vector<ll>;
template <typename T>
struct Matrix {
  ll H, W;
  vector<vector<T>> data;
  pi shape;
  Matrix(ll H, ll W) : H(H), W(W), data(H, vector<T>(W)), shape({H, W}) {}
  void fill(T x) {
    for (ll i = 0; (i) < (ll)(H); ++(i)) {
      for (ll j = 0; (j) < (ll)(W); ++(j)) data[i][j] = x;
    }
  }
  vector<T>& operator[](ll i) { return data[i]; }
  bool operator==(Matrix<T>& other) {
    if (H != other.H || W != other.W) return false;
    for (ll i = 0; (i) < (ll)(H); ++(i))
      for (ll j = 0; (j) < (ll)(W); ++(j)) {
        if (data[i][j] != other[i][j]) return false;
      }
    return true;
  }
  Matrix rot() {
    auto B = Matrix(W, H);
    for (ll i = 0; (i) < (ll)(W); ++(i)) {
      for (ll j = 0; (j) < (ll)(H); ++(j)) {
        B[i][j] = (*this)[j][W - 1 - i];
      }
    }
    return B;
  }
};
ll in() {
  ll i;
  cin >> i;
  return i;
}
pi in2() {
  ll a, b;
  cin >> a >> b;
  return {a, b};
}
tuple<ll, ll, ll> in3() {
  ll a, b, c;
  cin >> a >> b >> c;
  return {a, b, c};
}
tuple<ll, ll, ll, ll> in4() {
  ll a, b, c, d;
  cin >> a >> b >> c >> d;
  return {a, b, c, d};
}
tuple<ll, ll, ll, ll, ll> in5() {
  ll a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  return {a, b, c, d, e};
}
vi vin(ll n) {
  vi A(n);
  for (auto&& x : A) {
    cin >> x;
  }
  return A;
}
string sin() {
  string s;
  cin >> s;
  return s;
}
vi s_to_vi(string S, char first_char = 'a') {
  vi A(S.size());
  for (ll i = 0; (i) < (ll)(S.size()); ++(i)) {
    A[i] = S[i] - first_char;
  }
  return A;
}
Matrix<ll> matrixin(ll H, ll W) {
  Matrix<ll> A(H, W);
  for (ll i = 0; (i) < (ll)(H); ++(i)) {
    for (ll j = 0; (j) < (ll)(W); ++(j)) {
      A[i][j] = in();
    }
  }
  return A;
}
Matrix<char> cmatrixin(ll H, ll W) {
  Matrix<char> A(H, W);
  for (ll i = 0; (i) < (ll)(H); ++(i)) {
    string S = sin();
    for (ll j = 0; (j) < (ll)(W); ++(j)) {
      A[i][j] = S[j];
    }
  }
  return A;
}
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& A) {
  os << A.first << " " << A.second;
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& A) {
  for (size_t i = 0; i < A.size(); i++) {
    if (i) os << " ";
    os << A[i];
  }
  return os;
}
void print() { cout << "\n"; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail)) cout << " ";
  print(forward<Tail>(tail)...);
}
template <typename T>
string join(vector<T>& v) {
  ostringstream os;
  for (auto&& x : v) {
    os << x;
  }
  return os.str();
}
void YES() { print("YES"); }
void NO() { print("NO"); }
void Yes() { print("Yes"); }
void No() { print("No"); }
template <typename T>
ll sum(T A) {
  return accumulate(A.begin(), A.end(), 0LL);
}
template <typename T>
vector<T> cumsum(vector<T> A) {
  ll N = A.size();
  vector<T> B(N + 1);
  B[0] = T(0);
  for (ll i = 0; (i) < (ll)(N); ++(i)) {
    B[i + 1] = B[i] + A[i];
  }
  return B;
}
vi bin_count(vi& A, ll size) {
  vi C(size);
  for (auto&& x : A) {
    ++C[x];
  }
  return C;
}
template <typename T>
vi argsort(vector<T>& A) {
  vi ids(A.size());
  iota(ids.begin(), ids.end(), 0);
  sort(ids.begin(), ids.end(),
       [&](ll i, ll j) { return make_pair(A[i], i) <= make_pair(A[j], j); });
  return ids;
}
template <typename T>
ll argmax(vector<T>& A) {
  return max_element(A.begin(), A.end()) - A.begin();
}
template <typename T>
ostream& operator<<(ostream& os, Matrix<T>& A) {
  for (ll i = 0; (i) < (ll)(A.H); ++(i)) {
    if (i) os << "\n";
    os << A[i];
  }
  return os;
}
template <class T, class U>
bool chmax(T& a, const U& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>
bool chmin(T& a, const U& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
void solve() {
  auto [x1, y1, r1] = in3();
  auto [x2, y2, r2] = in3();
  ll dx = x1 - x2, dy = y1 - y2;
  if (dx * dx + dy * dy >= (r1 + r2) * (r1 + r2)) {
    print(0);
    return;
  }
  if (dx * dx + dy * dy <= (r1 - r2) * (r1 - r2)) {
    ld r = min(r1, r2);
    print(3.14159265359 * r * r);
    return;
  }
  ld d = sqrt(dx * dx + dy * dy);
  ld cos_1 = (r1 * r1 + dx * dx + dy * dy - r2 * r2) / (2 * d * r1);
  ld cos_2 = (r2 * r2 + dx * dx + dy * dy - r1 * r1) / (2 * d * r2);
  ld theta_1 = acos(cos_1);
  ld theta_2 = acos(cos_2);
  ld ans = r1 * r1 * (theta_1 - sin(2 * theta_1) / 2);
  ans += r2 * r2 * (theta_2 - sin(2 * theta_2) / 2);
  print(ans);
}
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << setprecision(15);
  solve();
  return 0;
}