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;
long long int powmod(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int x = powmod(a, b / 2);
  long long int y = (x * x) % 1000000007;
  if (b % 2) return (a * y) % 1000000007;
  return y % 1000000007;
}
long double EPS = 1e-9;
long double PI = 3.1415926535897932384626433832795;
struct Point {
  long double x, y;
  Point() {}
  Point(long double x, long double y) : x(x), y(y) {}
  Point(const Point &p) : x(p.x), y(p.y) {}
  Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
  Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
  Point operator*(long double c) const { return Point(x * c, y * c); }
  Point operator/(long double c) const { return Point(x / c, y / c); }
};
long double dot(Point p, Point q) { return p.x * q.x + p.y * q.y; }
long double dist(Point p, Point q) { return sqrt(dot(p - q, p - q)); }
long double AreaOfCircleCircleIntersection(Point a, long double r1, Point b,
                                           long double r2) {
  long double d = dist(a, b);
  if (r1 + r2 < d + EPS) return 0;
  if (r1 + d < r2 + EPS) return PI * r1 * r1;
  if (r2 + d < r1 + EPS) return PI * r2 * r2;
  long double theta_1 = acos((r1 * r1 + d * d - r2 * r2) / (2 * r1 * d));
  long double theta_2 = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));
  return r1 * r1 * (theta_1 - sin(2 * theta_1) / 2.) +
         r2 * r2 * (theta_2 - sin(2 * theta_2) / 2.);
}
int main() {
  long double x1, y1, r1, x2, y2, r2;
  cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
  cout << setprecision(9) << fixed
       << AreaOfCircleCircleIntersection(Point(x1, y1), r1, Point(x2, y2), r2);
  return 0;
}