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;
template <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T, class U>
inline void print(T first, U second) {
  printsp(first);
  println(second);
}
template <class T, class U, class V>
inline void print(T first, U second, V z) {
  printsp(first);
  printsp(second);
  println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
long double pi = acosl(-1);
struct point {
  long double first, second;
  point(long double first = 0, long double second = 0)
      : first(first), second(second) {}
  point operator-(point a) { return point(first - a.first, second - a.second); }
  point operator+(point a) { return point(first + a.first, second + a.second); }
  point operator*(long double a) { return point(first * a, second * a); }
  point operator/(long double a) { return point(first / a, second / a); }
  point operator&(point a) {
    return point(first * a.first - second * a.second,
                 first * a.second + second * a.first);
  }
  point rotate(long double al) { return *this & point(cos(al), sin(al)); }
  long double operator^(point a) { return first * a.second - second * a.first; }
  long double operator*(point a) { return first * a.first + second * a.second; }
  point norm() {
    long double s = nor();
    if (s < 1e-9) return *this;
    return point(first / s, second / s);
  }
  point conj() { return point(-second, first); }
  long double nor() { return sqrtl(*this * *this); }
  long double al() { return atan2(second, first); }
  bool operator<(const point &a) const {
    if (fabsl(first - a.first) > 1e-9) return first < a.first;
    return second < a.second - 1e-9;
  }
  bool operator>(const point &a) const {
    if (fabsl(first - a.first) > 1e-9) return first > a.first;
    return second > a.second + 1e-9;
  }
  bool operator==(const point &a) const {
    if (fabsl(first - a.first) > 1e-9) return 0;
    return fabsl(second - a.second) < 1e-9;
  }
  bool operator!=(const point &a) const {
    if (*this == a) return false;
    return true;
  }
  void input() { cin >> first >> second; }
  void print() { cout << first << ' ' << second << endl; }
};
int main() {
  cout << fixed << setprecision(9);
  point a, b;
  long double ra, rb;
  a.input();
  cin >> ra;
  b.input();
  cin >> rb;
  long double alpa, alpb;
  if (ra < rb + 1e-9) swap(a, b), swap(ra, rb);
  if ((a - b).nor() > ra + rb - 1e-9) {
    puts("0");
    return 0;
  }
  if ((b - a).nor() + rb < ra + 1e-9) {
    cout << pi * rb * rb << endl;
    return 0;
  }
  auto f = [](long double a, long double b, long double c) {
    return acosl((((a) * (a)) + ((b) * (b)) - ((c) * (c))) / (2 * a * b));
  };
  alpa = 2 * f(ra, (a - b).nor(), rb);
  alpb = 2 * f(rb, (a - b).nor(), ra);
  long double ans = (alpa - sin(alpa)) * ((ra) * (ra)) / 2 +
                    (alpb - sin(alpb)) * ((rb) * (rb)) / 2;
  cout << ans << endl;
  return 0;
}