#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

typedef long long LL;
const long double pi=acos(-1.0);
const long double eps=1e-7;

#define sq(A) ((A)*(A))

long double dist2(long double x1, long double x2, long double y1, long double y2){
	return sq(x1-x2)+sq(y1-y2);
}

long double dist(long double x1, long double x2, long double y1, long double y2){
	return sqrt(sq(x1-x2)+sq(y1-y2));
}

long double cross(long double x1, long double y1, long double x2, long double y2, long double x3, long double y3){
	return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
}

int main(){
	LL x[4], y[4], r[2], d2;
	long double a, b, d;
	cout << setprecision(15);
	for(int i=0;i<2;++i) cin >> x[i] >> y[i] >> r[i];
	d2=sq(x[0]-x[1])+sq(y[0]-y[1]);
	if(r[0]>r[1]) swap(r[0], r[1]);
	if(d2>=sq(r[0]+r[1])){
		cout << 0.0 << '\n';
		return 0;
	}
	if(d2<=sq(r[1]-r[0])){
		cout << pi*sq(r[0]) << '\n';
		return 0;
	}
	d=sqrt(d2);
	a=acos((sq(r[1])-sq(r[0])+d2)/(2*d*r[1]));
	b=acos((sq(r[0])-sq(r[1])+d2)/(2*d*r[0]));
	cout << a*sq(r[1])+b*sq(r[0])-sq(r[1])*cos(a)*sin(a)-sq(r[0])*cos(b)*sin(b) << '\n';
	return 0;
}


#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

typedef long long LL;
const double pi=acos(-1.0);
const double eps=1e-7;

#define sq(A) ((A)*(A))

double dist2(double x1, double x2, double y1, double y2){
	return sq(x1-x2)+sq(y1-y2);
}

double dist(double x1, double x2, double y1, double y2){
	return sqrt(sq(x1-x2)+sq(y1-y2));
}

double cross(double x1, double y1, double x2, double y2, double x3, double y3){
	return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
}

int main(){
	LL x[4], y[4], r[2], d2;
	double l, v, a, b, d;
	cout << setprecision(15);
	for(int i=0;i<2;++i) cin >> x[i] >> y[i] >> r[i];
	d2=sq(x[0]-x[1])+sq(y[0]-y[1]);
	if(r[0]>r[1]) swap(r[0], r[1]);
	if(d2>=sq(r[0]+r[1])){
		cout << 0.0 << '\n';
		return 0;
	}
	if(d2<=sq(r[1]-r[0])){
		cout << pi*sq(r[0]) << '\n';
		return 0;
	}
	d=sqrt(d2);
	l=(sq(r[1])-sq(r[0])+d2)/(2*d);
	a=acos(l/r[1]);
	b=acos((d-l)/r[0]);
	cout << a*sq(r[1])+b*sq(r[0])-r[1]*sin(a)*l-r[0]*sin(b)*(d-l) << '\n';
	return 0;
}


#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

const double pi=acos(-1.0);
const double eps=1e-7;

#define sq(A) ((A)*(A))

double dist2(double x1, double x2, double y1, double y2){
	return sq(x1-x2)+sq(y1-y2);
}

double dist(double x1, double x2, double y1, double y2){
	return sqrt(sq(x1-x2)+sq(y1-y2));
}

double cross(double x1, double y1, double x2, double y2, double x3, double y3){
	return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
}

int main(){
	double x[4], y[4], r[2], l, v, a, b;
	cout << setprecision(15);
	for(int i=0;i<2;++i) cin >> x[i] >> y[i] >> r[i];
	double d2=dist2(x[0], x[1], y[0], y[1]);
	double d=dist(x[0], x[1], y[0], y[1]);
	if(r[0]>r[1]) swap(r[0], r[1]);
	if(d>=r[0]+r[1]){
		cout << 0.0 << '\n';
		return 0;
	}
	if(d+r[0]<=r[1]){
		cout << pi*sq(r[0]) << '\n';
		return 0;
	}
	l=(sq(r[1])-sq(r[0])+d2)/(2*d);
	v=sqrt(sq(r[1])-sq(l));
	a=atan2(v, l);
	b=atan2(v, d-l);
	cout << a*sq(r[1])+b*sq(r[0])-cross(0, 0, l, 0, l, v)-cross(d, 0, l, v, l, 0) << '\n';
	return 0;
}


#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

typedef long long LL;
const long double pi=3.141592653589793;
const long double eps=1e-7;

#define sq(A) ((A)*(A))

long double dist2(long double x1, long double x2, long double y1, long double y2){
	return sq(x1-x2)+sq(y1-y2);
}

long double dist(long double x1, long double x2, long double y1, long double y2){
	return sqrt(sq(x1-x2)+sq(y1-y2));
}

long double cross(long double x1, long double y1, long double x2, long double y2, long double x3, long double y3){
	return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
}

int main(){
	LL x[4], y[4], r[2], d2;
	long double a, b, d;
	cout << setprecision(30);
	for(int i=0;i<2;++i) cin >> x[i] >> y[i] >> r[i];
	d2=sq(x[0]-x[1])+sq(y[0]-y[1]);
	if(r[0]>r[1]) swap(r[0], r[1]);
	if(d2>=sq(r[0]+r[1])){
		cout << 0.0 << '\n';
		return 0;
	}
	if(d2<=sq(r[1]-r[0])){
		cout << pi*sq(r[0]) << '\n';
		return 0;
	}
	d=sqrt(d2);
	a=acos((sq(r[1])+sq(d)-sq(r[0]))/(2*d*r[1]));
	b=acos((sq(r[0])+sq(d)-sq(r[1]))/(2*d*r[0]));
	cout << sq(r[1])*(a-sin(a)*cos(a))+sq(r[0])*(b-sin(b)*cos(b)) << '\n';
	return 0;
}


#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

const double pi=acos(-1.0);
const double eps=1e-7;

#define sq(A) ((A)*(A))

double dist2(double x1, double x2, double y1, double y2){
	return sq(x1-x2)+sq(y1-y2);
}

double dist(double x1, double x2, double y1, double y2){
	return sqrt(sq(x1-x2)+sq(y1-y2));
}

double cross(double x1, double y1, double x2, double y2, double x3, double y3){
	return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
}

int main(){
	double x[4], y[4], r[2], l, v, a, b;
	cout << setprecision(15);
	for(int i=0;i<2;++i) cin >> x[i] >> y[i] >> r[i];
	double d2=dist2(x[0], x[1], y[0], y[1]);
	double d=dist(x[0], x[1], y[0], y[1]);
	if(r[0]>r[1]) swap(r[0], r[1]);
	if(d>r[0]+r[1]){
		cout << 0.0 << '\n';
		return 0;
	}
	if(d+r[0]<r[1]){
		cout << pi*sq(r[0]) << '\n';
		return 0;
	}
	l=(sq(r[1])-sq(r[0])+d2)/(2*d);
	v=sqrt(sq(r[1])-sq(l));
	a=atan2(v, l);
	b=atan2(v, d-l);
	cout << a*sq(r[1])+b*sq(r[0])-cross(0, 0, l, 0, l, v)-cross(d, 0, l, v, l, 0) << '\n';
	return 0;
}


#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

typedef long long LL;
const double pi=acos(-1.0);
const double eps=1e-7;

#define sq(A) ((A)*(A))

double dist2(double x1, double x2, double y1, double y2){
	return sq(x1-x2)+sq(y1-y2);
}

double dist(double x1, double x2, double y1, double y2){
	return sqrt(sq(x1-x2)+sq(y1-y2));
}

double cross(double x1, double y1, double x2, double y2, double x3, double y3){
	return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
}

int main(){
	LL x[4], y[4], r[2], d2;
	double l, a, b, d;
	cout << setprecision(15);
	for(int i=0;i<2;++i) cin >> x[i] >> y[i] >> r[i];
	d2=sq(x[0]-x[1])+sq(y[0]-y[1]);
	if(r[0]>r[1]) swap(r[0], r[1]);
	if(d2>=sq(r[0]+r[1])){
		cout << 0.0 << '\n';
		return 0;
	}
	if(d2<=sq(r[1]-r[0])){
		cout << pi*sq(r[0]) << '\n';
		return 0;
	}
	d=sqrt(d2);
	l=(sq(r[1])-sq(r[0])+d2)/(2*d);
	a=acos(l/r[1]);
	b=acos((d-l)/r[0]);
	cout << a*sq(r[1])+b*sq(r[0])-sq(r[1])*cos(a)*sin(a)-sq(r[0])*cos(b)*sin(b) << '\n';
	return 0;
}


#include<iostream>
#include<iomanip>
#include<math.h>

using namespace std;

typedef long long LL;
const long double pi=3.141592653589793;
const long double eps=1e-7;

#define sq(A) ((A)*(A))

long double dist2(long double x1, long double x2, long double y1, long double y2){
	return sq(x1-x2)+sq(y1-y2);
}

long double dist(long double x1, long double x2, long double y1, long double y2){
	return sqrt(sq(x1-x2)+sq(y1-y2));
}

long double cross(long double x1, long double y1, long double x2, long double y2, long double x3, long double y3){
	return (x2-x1)*(y3-y1)-(x3-x1)*(y2-y1);
}

int main(){
	long double a, b, d, x[2], y[2], r[2];
	cout << setprecision(30);
	for(int i=0;i<2;++i) cin >> x[i] >> y[i] >> r[i];
	d=sqrt(sq(x[0]-x[1])+sq(y[0]-y[1]));
	if(r[0]>r[1]) swap(r[0], r[1]);
	if(d>=r[0]+r[1]-eps){
		cout << 0.0 << '\n';
		return 0;
	}
	if(d<=r[1]-r[0]+eps){
		cout << pi*sq(r[0]) << '\n';
		return 0;
	}
	a=acos((sq(r[1])+sq(d)-sq(r[0]))/(2*d*r[1]));
	b=acos((sq(r[0])+sq(d)-sq(r[1]))/(2*d*r[0]));
	cout << sq(r[1])*a-sq(r[1])*sin(a)*cos(a)+sq(r[0])*b-sq(r[0])*sin(b)*cos(b) << '\n';
	return 0;
}


#include <bits/stdc++.h>
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi acos(-1)
#define nu 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)
#define tc int t;cin>>t;while(t--)
#define tcf ll t;cin>>t;for(int w=1;w<=t;w++)
const int mod = 1000000007;
const int md = 998244353;
using namespace std;
ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = (res * a);
        }
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll binpowmod(ll a, ll b, ll m)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = ((res % m) * (a % m)) % m;
        }
        a = ((a % m) * (a % m)) % m;
        b >>= 1;
    }
    return res;
}
void dex(int a) {
    if (a == 1)cout << "1\n"; else if (a == -1)cout << "-1\n"; else if (a == 0)cout << "0\n";
    else if (a == 2)cout << "YES\n"; else if (a == 3)cout << "NO\n"; else if (a == 4)cout << "yes\n";
    else if (a == 5)cout << "no\n";
}
ll fermat_inv(ll y) {return binpow(y, mod - 2);}
ll fact[100005];
ll finv[100005];
void factorial(int n) {
    fact[0] = 1;
    finv[0] = 1;
    for (int i = 1; i <= n; i++)
        fact[i] = fact[i - 1] * i, fact[i] %= mod, finv[i] = fermat_inv(fact[i]);
}
ll ncr(ll n, ll r)
{
    if (n < r)
        return 0;
    else {
        ll x = finv[r] * finv[n - r] % mod;
        return fact[n] * x % mod;
    }
}
bool prime[10000001];
void seive()
{
    memset(prime, 1, sizeof(prime));
    for (ll i = 2; i * i <= 10000001; i++)
    {
        if (prime[i] == 1)
        {
            for (ll j = i * i; j <= 10000001 ; j += i)
            {
                prime[j] = 0;
            }
        }
    }
}
bool primech(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}

//Polynomial Rolling Hash function\\

const int MOD = 1e9 + 9;
const int p_o = 53;
vector<ll>p_pow;
void ffpow(ll n)
{

    p_pow.resize(n);
    p_pow[0] = 1;
    F(i, 1, n)
    {
        p_pow[i] = (p_pow[i - 1] * p_o) % MOD;
    }
}
ll Hash(string const&s)
{
    ll res = 0;
    ll j = 0;
    for (auto i : s)
    {
        res += (((i - 'a' + 1) % MOD) * (p_pow[j] % MOD)) % MOD;
        j++;
    }
    return res;
}
vector<ll>adj[100010];
vector<ll>vis(100010, 0);
//vector<ll>visi(100010, 0);
vector<ll>sub(200010, 0);
vector<ll>R(100010, 0);
vector<ll>par(100010);
//vector<ll>col(200010);
//vector<ll>dis(100010, 0);
//vector<ll>st(400000, 0);
ll dfs(ll node)
{
    ll c = 1;
    vis[node] = 1;
    for (auto i : adj[node])
    {
        if (!vis[i])
        {
            c += dfs(i);
        }
    }
    sub[node] = c;
    return c;
}
void bfs(ll node)
{
    vis[node] = 1;
    queue<ll>q;
    q.push(node);
    while (!q.empty())
    {
        ll src = q.front();
        q.pop();
        for (auto i : adj[src])
        {

            if (!vis[i])
            {
                cout << src << " " << i << "\n";
                q.push(i);
                vis[i] = 1;
            }
        }
    }
}
int Find(int x)
{
    if (par[x] < 0)
        return x;
    return par[x] = Find(par[x]);
}
void Union(int x, int y)
{
    if (R[x] > R[y])
    {
        par[x] += par[y];
        R[x] += R[y];
        par[y] = x;
    }
    else
    {
        par[y] += par[x];
        R[y] += R[x];
        par[x] = y;
    }
}
bool ispali(ll n)
{
    ll k = n;
    ll rev = 0;
    while (n > 0)
    {
        rev += rev * 10 + n % 10;
        n /= 10;
    }
    if (rev == k)return true;
    return false;
}
// bool isprimeMR(ll n)    //Miller-Robin O(logn) approach
// {
//     if (n < 2) {return false;}
//     for (ll x : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37})
//     {
//         if (n == x)
//             return true;
//         bool flag = true;
//         ll r = 1;
//         ll t = 1;
//         while (r <= ((n - 1) >> __builtin_ctzll(n - 1)))
//         {
//             if (r & ((n - 1) >> __builtin_ctzll(n - 1)))
//                 t = (t * x) % n;
//             x = (x * x) % n;
//             r <<= 1;
//         }
//         if (t == 1 || t == n - 1)
//             flag = false;
//         for (r = 0; r < __builtin_ctzll(n - 1); r++)
//         {
//             t = (t * t) % n;
//             if (t == n - 1)
//                 flag = false;
//         }
//         if (flag)
//             return false;
//     }
//     return true;
// }

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ld x1, y1, r1, x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    ld ans = 0;
    if (d >= (r1 + r2))
    {
        cout << fixed << setprecision(6) << ans << "\n";
    }
    else
    {
        ld a = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));
        ld b = acos((r1 * r1 + d * d - r2 * r2) / (2 * r1 * d));
        ans = (r1 * r1) * (b - sin(b) * cos(b)) + (r2 * r2) * (a - sin(a) * cos(a));
        cout << fixed << setprecision(12) << ans << "\n";
    }

    return 0;

}


#include <bits/stdc++.h>
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.1415926535897932384626
#define nu 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)
#define tc int t;cin>>t;while(t--)
#define tcf ll t;cin>>t;for(int w=1;w<=t;w++)
const int mod = 1000000007;
const int md = 998244353;
using namespace std;
ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = (res * a);
        }
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll binpowmod(ll a, ll b, ll m)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = ((res % m) * (a % m)) % m;
        }
        a = ((a % m) * (a % m)) % m;
        b >>= 1;
    }
    return res;
}
void dex(int a) {
    if (a == 1)cout << "1\n"; else if (a == -1)cout << "-1\n"; else if (a == 0)cout << "0\n";
    else if (a == 2)cout << "YES\n"; else if (a == 3)cout << "NO\n"; else if (a == 4)cout << "yes\n";
    else if (a == 5)cout << "no\n";
}
ll fermat_inv(ll y) {return binpow(y, mod - 2);}
ll fact[100005];
ll finv[100005];
void factorial(int n) {
    fact[0] = 1;
    finv[0] = 1;
    for (int i = 1; i <= n; i++)
        fact[i] = fact[i - 1] * i, fact[i] %= mod, finv[i] = fermat_inv(fact[i]);
}
ll ncr(ll n, ll r)
{
    if (n < r)
        return 0;
    else {
        ll x = finv[r] * finv[n - r] % mod;
        return fact[n] * x % mod;
    }
}
bool prime[10000001];
void seive()
{
    memset(prime, 1, sizeof(prime));
    for (ll i = 2; i * i <= 10000001; i++)
    {
        if (prime[i] == 1)
        {
            for (ll j = i * i; j <= 10000001 ; j += i)
            {
                prime[j] = 0;
            }
        }
    }
}
bool primech(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}

//Polynomial Rolling Hash function\\

const int MOD = 1e9 + 9;
const int p_o = 53;
vector<ll>p_pow;
void ffpow(ll n)
{

    p_pow.resize(n);
    p_pow[0] = 1;
    F(i, 1, n)
    {
        p_pow[i] = (p_pow[i - 1] * p_o) % MOD;
    }
}
ll Hash(string const&s)
{
    ll res = 0;
    ll j = 0;
    for (auto i : s)
    {
        res += (((i - 'a' + 1) % MOD) * (p_pow[j] % MOD)) % MOD;
        j++;
    }
    return res;
}
vector<ll>adj[100010];
vector<ll>vis(100010, 0);
//vector<ll>visi(100010, 0);
vector<ll>sub(200010, 0);
vector<ll>R(100010, 0);
vector<ll>par(100010);
//vector<ll>col(200010);
//vector<ll>dis(100010, 0);
//vector<ll>st(400000, 0);
ll dfs(ll node)
{
    ll c = 1;
    vis[node] = 1;
    for (auto i : adj[node])
    {
        if (!vis[i])
        {
            c += dfs(i);
        }
    }
    sub[node] = c;
    return c;
}
void bfs(ll node)
{
    vis[node] = 1;
    queue<ll>q;
    q.push(node);
    while (!q.empty())
    {
        ll src = q.front();
        q.pop();
        for (auto i : adj[src])
        {

            if (!vis[i])
            {
                cout << src << " " << i << "\n";
                q.push(i);
                vis[i] = 1;
            }
        }
    }
}
int Find(int x)
{
    if (par[x] < 0)
        return x;
    return par[x] = Find(par[x]);
}
void Union(int x, int y)
{
    if (R[x] > R[y])
    {
        par[x] += par[y];
        R[x] += R[y];
        par[y] = x;
    }
    else
    {
        par[y] += par[x];
        R[y] += R[x];
        par[x] = y;
    }
}
bool ispali(ll n)
{
    ll k = n;
    ll rev = 0;
    while (n > 0)
    {
        rev += rev * 10 + n % 10;
        n /= 10;
    }
    if (rev == k)return true;
    return false;
}
// bool isprimeMR(ll n)    //Miller-Robin O(logn) approach
// {
//     if (n < 2) {return false;}
//     for (ll x : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37})
//     {
//         if (n == x)
//             return true;
//         bool flag = true;
//         ll r = 1;
//         ll t = 1;
//         while (r <= ((n - 1) >> __builtin_ctzll(n - 1)))
//         {
//             if (r & ((n - 1) >> __builtin_ctzll(n - 1)))
//                 t = (t * x) % n;
//             x = (x * x) % n;
//             r <<= 1;
//         }
//         if (t == 1 || t == n - 1)
//             flag = false;
//         for (r = 0; r < __builtin_ctzll(n - 1); r++)
//         {
//             t = (t * t) % n;
//             if (t == n - 1)
//                 flag = false;
//         }
//         if (flag)
//             return false;
//     }
//     return true;
// }

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ld x1, y1, r1, x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    ld ans = 0;
    if (d >= (r1 + r2))
    {
        cout << fixed << setprecision(12) << ans << "\n";
    }
    else if ((x1 == x2 && y1 == y2 ) || abs(r1 - r2) >= d)
    {
        ld ans1 = pi * r1 * r1;
        ld ans2 = pi * r2 * r2;
        ans = min(ans1, ans2);
        cout << fixed << setprecision(12) << ans << "\n";
    }
    else
    {
        ld a = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));
        ld b = acos((r1 * r1 + d * d - r2 * r2) / (2 * r1 * d));
        ans = (r1 * r1) * (b - sin(b) * cos(b)) + (r2 * r2) * (a - sin(a) * cos(a));
        cout << fixed << setprecision(12) << ans << "\n";
    }

    return 0;

}


#include <bits/stdc++.h>
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi 3.1415926535897932384626
#define nu 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)
#define tc int t;cin>>t;while(t--)
#define tcf ll t;cin>>t;for(int w=1;w<=t;w++)
const int mod = 1000000007;
const int md = 998244353;
using namespace std;
ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = (res * a);
        }
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll binpowmod(ll a, ll b, ll m)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = ((res % m) * (a % m)) % m;
        }
        a = ((a % m) * (a % m)) % m;
        b >>= 1;
    }
    return res;
}
void dex(int a) {
    if (a == 1)cout << "1\n"; else if (a == -1)cout << "-1\n"; else if (a == 0)cout << "0\n";
    else if (a == 2)cout << "YES\n"; else if (a == 3)cout << "NO\n"; else if (a == 4)cout << "yes\n";
    else if (a == 5)cout << "no\n";
}
ll fermat_inv(ll y) {return binpow(y, mod - 2);}
ll fact[100005];
ll finv[100005];
void factorial(int n) {
    fact[0] = 1;
    finv[0] = 1;
    for (int i = 1; i <= n; i++)
        fact[i] = fact[i - 1] * i, fact[i] %= mod, finv[i] = fermat_inv(fact[i]);
}
ll ncr(ll n, ll r)
{
    if (n < r)
        return 0;
    else {
        ll x = finv[r] * finv[n - r] % mod;
        return fact[n] * x % mod;
    }
}
bool prime[10000001];
void seive()
{
    memset(prime, 1, sizeof(prime));
    for (ll i = 2; i * i <= 10000001; i++)
    {
        if (prime[i] == 1)
        {
            for (ll j = i * i; j <= 10000001 ; j += i)
            {
                prime[j] = 0;
            }
        }
    }
}
bool primech(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}

//Polynomial Rolling Hash function\\

const int MOD = 1e9 + 9;
const int p_o = 53;
vector<ll>p_pow;
void ffpow(ll n)
{

    p_pow.resize(n);
    p_pow[0] = 1;
    F(i, 1, n)
    {
        p_pow[i] = (p_pow[i - 1] * p_o) % MOD;
    }
}
ll Hash(string const&s)
{
    ll res = 0;
    ll j = 0;
    for (auto i : s)
    {
        res += (((i - 'a' + 1) % MOD) * (p_pow[j] % MOD)) % MOD;
        j++;
    }
    return res;
}
vector<ll>adj[100010];
vector<ll>vis(100010, 0);
//vector<ll>visi(100010, 0);
vector<ll>sub(200010, 0);
vector<ll>R(100010, 0);
vector<ll>par(100010);
//vector<ll>col(200010);
//vector<ll>dis(100010, 0);
//vector<ll>st(400000, 0);
ll dfs(ll node)
{
    ll c = 1;
    vis[node] = 1;
    for (auto i : adj[node])
    {
        if (!vis[i])
        {
            c += dfs(i);
        }
    }
    sub[node] = c;
    return c;
}
void bfs(ll node)
{
    vis[node] = 1;
    queue<ll>q;
    q.push(node);
    while (!q.empty())
    {
        ll src = q.front();
        q.pop();
        for (auto i : adj[src])
        {

            if (!vis[i])
            {
                cout << src << " " << i << "\n";
                q.push(i);
                vis[i] = 1;
            }
        }
    }
}
int Find(int x)
{
    if (par[x] < 0)
        return x;
    return par[x] = Find(par[x]);
}
void Union(int x, int y)
{
    if (R[x] > R[y])
    {
        par[x] += par[y];
        R[x] += R[y];
        par[y] = x;
    }
    else
    {
        par[y] += par[x];
        R[y] += R[x];
        par[x] = y;
    }
}
bool ispali(ll n)
{
    ll k = n;
    ll rev = 0;
    while (n > 0)
    {
        rev += rev * 10 + n % 10;
        n /= 10;
    }
    if (rev == k)return true;
    return false;
}
// bool isprimeMR(ll n)    //Miller-Robin O(logn) approach
// {
//     if (n < 2) {return false;}
//     for (ll x : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37})
//     {
//         if (n == x)
//             return true;
//         bool flag = true;
//         ll r = 1;
//         ll t = 1;
//         while (r <= ((n - 1) >> __builtin_ctzll(n - 1)))
//         {
//             if (r & ((n - 1) >> __builtin_ctzll(n - 1)))
//                 t = (t * x) % n;
//             x = (x * x) % n;
//             r <<= 1;
//         }
//         if (t == 1 || t == n - 1)
//             flag = false;
//         for (r = 0; r < __builtin_ctzll(n - 1); r++)
//         {
//             t = (t * t) % n;
//             if (t == n - 1)
//                 flag = false;
//         }
//         if (flag)
//             return false;
//     }
//     return true;
// }

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ld x1, y1, r1, x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    ld ans = 0;
    if (d >= (r1 + r2))
    {
        cout << fixed << setprecision(12) << ans << "\n";
    }
    else if (x1 == x2 && y1 == y2)
    {
        ld ans1 = pi * r1 * r1;
        ld ans2 = pi * r2 * r2;
        ans = min(ans1, ans2);
        cout << fixed << setprecision(12) << ans << "\n";
    }
    else
    {
        ld a = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));
        ld b = acos((r1 * r1 + d * d - r2 * r2) / (2 * r1 * d));
        ans = (r1 * r1) * (b - sin(b) * cos(b)) + (r2 * r2) * (a - sin(a) * cos(a));
        cout << fixed << setprecision(12) << ans << "\n";
    }

    return 0;

}


#include <bits/stdc++.h>
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define pi acos(-1)
#define nu 100
#define INF 100000000000
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#define F(i,a,n) for(ll i=a;i<n;i++)
#define B(i,a,n) for(ll i=n-1;i>=a;i--)
#define tc int t;cin>>t;while(t--)
#define tcf ll t;cin>>t;for(int w=1;w<=t;w++)
const int mod = 1000000007;
const int md = 998244353;
using namespace std;
ll binpow(ll a, ll b)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = (res * a);
        }
        a = (a * a);
        b >>= 1;
    }
    return res;
}
ll binpowmod(ll a, ll b, ll m)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
        {
            res = ((res % m) * (a % m)) % m;
        }
        a = ((a % m) * (a % m)) % m;
        b >>= 1;
    }
    return res;
}
void dex(int a) {
    if (a == 1)cout << "1\n"; else if (a == -1)cout << "-1\n"; else if (a == 0)cout << "0\n";
    else if (a == 2)cout << "YES\n"; else if (a == 3)cout << "NO\n"; else if (a == 4)cout << "yes\n";
    else if (a == 5)cout << "no\n";
}
ll fermat_inv(ll y) {return binpow(y, mod - 2);}
ll fact[100005];
ll finv[100005];
void factorial(int n) {
    fact[0] = 1;
    finv[0] = 1;
    for (int i = 1; i <= n; i++)
        fact[i] = fact[i - 1] * i, fact[i] %= mod, finv[i] = fermat_inv(fact[i]);
}
ll ncr(ll n, ll r)
{
    if (n < r)
        return 0;
    else {
        ll x = finv[r] * finv[n - r] % mod;
        return fact[n] * x % mod;
    }
}
bool prime[10000001];
void seive()
{
    memset(prime, 1, sizeof(prime));
    for (ll i = 2; i * i <= 10000001; i++)
    {
        if (prime[i] == 1)
        {
            for (ll j = i * i; j <= 10000001 ; j += i)
            {
                prime[j] = 0;
            }
        }
    }
}
bool primech(ll n)
{
    if (n <= 1)  return false;
    if (n <= 3)  return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
}

//Polynomial Rolling Hash function\\

const int MOD = 1e9 + 9;
const int p_o = 53;
vector<ll>p_pow;
void ffpow(ll n)
{

    p_pow.resize(n);
    p_pow[0] = 1;
    F(i, 1, n)
    {
        p_pow[i] = (p_pow[i - 1] * p_o) % MOD;
    }
}
ll Hash(string const&s)
{
    ll res = 0;
    ll j = 0;
    for (auto i : s)
    {
        res += (((i - 'a' + 1) % MOD) * (p_pow[j] % MOD)) % MOD;
        j++;
    }
    return res;
}
vector<ll>adj[100010];
vector<ll>vis(100010, 0);
//vector<ll>visi(100010, 0);
vector<ll>sub(200010, 0);
vector<ll>R(100010, 0);
vector<ll>par(100010);
//vector<ll>col(200010);
//vector<ll>dis(100010, 0);
//vector<ll>st(400000, 0);
ll dfs(ll node)
{
    ll c = 1;
    vis[node] = 1;
    for (auto i : adj[node])
    {
        if (!vis[i])
        {
            c += dfs(i);
        }
    }
    sub[node] = c;
    return c;
}
void bfs(ll node)
{
    vis[node] = 1;
    queue<ll>q;
    q.push(node);
    while (!q.empty())
    {
        ll src = q.front();
        q.pop();
        for (auto i : adj[src])
        {

            if (!vis[i])
            {
                cout << src << " " << i << "\n";
                q.push(i);
                vis[i] = 1;
            }
        }
    }
}
int Find(int x)
{
    if (par[x] < 0)
        return x;
    return par[x] = Find(par[x]);
}
void Union(int x, int y)
{
    if (R[x] > R[y])
    {
        par[x] += par[y];
        R[x] += R[y];
        par[y] = x;
    }
    else
    {
        par[y] += par[x];
        R[y] += R[x];
        par[x] = y;
    }
}
bool ispali(ll n)
{
    ll k = n;
    ll rev = 0;
    while (n > 0)
    {
        rev += rev * 10 + n % 10;
        n /= 10;
    }
    if (rev == k)return true;
    return false;
}
// bool isprimeMR(ll n)    //Miller-Robin O(logn) approach
// {
//     if (n < 2) {return false;}
//     for (ll x : {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37})
//     {
//         if (n == x)
//             return true;
//         bool flag = true;
//         ll r = 1;
//         ll t = 1;
//         while (r <= ((n - 1) >> __builtin_ctzll(n - 1)))
//         {
//             if (r & ((n - 1) >> __builtin_ctzll(n - 1)))
//                 t = (t * x) % n;
//             x = (x * x) % n;
//             r <<= 1;
//         }
//         if (t == 1 || t == n - 1)
//             flag = false;
//         for (r = 0; r < __builtin_ctzll(n - 1); r++)
//         {
//             t = (t * t) % n;
//             if (t == n - 1)
//                 flag = false;
//         }
//         if (flag)
//             return false;
//     }
//     return true;
// }

int main()
{

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    ld x1, y1, r1, x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    ld ans = 0;
    if (d >= (r1 + r2))
    {
        cout << fixed << setprecision(6) << ans << "\n";
    }
    else
    {
        ld a = acos((r2 * r2 + d * d - r1 * r1) / (2 * r2 * d));
        ld b = acos((r1 * r1 + d * d - r2 * r2) / (2 * r1 * d));
        ans = (r1 * r1) * (b - sin(b) * cos(b)) + (r2 * r2) * (a - sin(a) * cos(a));
        cout << fixed << setprecision(6) << ans << "\n";
    }

    return 0;

}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    if (d + r1 <= r2)
        return pi * sqr(r1);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));

    ld al1 = atan2(h, l);
    ld al2 = atan2(h, d - l);
    ld s1 = al1 * sqr(r1)  - l * r1 * sin(al1);
    ld s2 = al2 * sqr(r2) - (d - l) * r2 * sin(al2);

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    if (r1 + d <= r2)
        return pi * sqr(r1);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));
    ld al1, al2;

    al1 = atan2(h, abs(l));

    if (h < EPS)
        al2 = 0;
    else
        al2 = atan2(h, d - l);

    ld s1 = al1 * sqr(r1) - l * r1 * sin(al1);
    ld s2 = al2 * sqr(r2) - (d - l) * r2 * sin(al2);

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    if (r1 + d <= r2)
        return pi * sqr(r1);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));
    ld al1, al2;

    al1 = atan2(h, abs(l));
    al2 = atan2(h, abs(d - l));

    ld s1 = al1 * sqr(r1) - abs(l) * r1 * sin(al1);
    ld s2 = al2 * sqr(r2) - b = abs(d - l) * r2 * sin(al2);

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    if (r1 + d <= r2)
        return pi * sqr(r1);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));
    ld al1, al2;

    al1 = atan2(h, abs(l));
    al2 = atan2(h, abs(d - l));

    ld s1 = al1 * sqr(r1);
    ld a = abs(l) * r1 * sin(al1);
    ld s2 = al2 * sqr(r2);
    ld b = abs(d - l) * r2 * sin(al2);
    s1 -= a;
    s2 -= b;

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));
    ld al1, al2;

    if (h < EPS)
        al1 = 0;
    else
        al1 = atan2(h, l);

    if (h < EPS)
        al2 = 0;
    else
        al2 = atan2(h, d - l);

    ld s1 = al1 * sqr(r1) - l * r1 * sin(al1);
    ld s2 = al2 * sqr(r2) - (d - l) * r2 * sin(al2);

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));

    ld al1 = atan2(h, l);
    ld al2 = atan2(h, d - l);
    ld s1 = al1 * sqr(r1)  - l * r1 * sin(al1);
    ld s2 = al2 * sqr(r2) - (d - l) * r2 * sin(al2);

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    if (r1 + d <= r2)
        return pi * sqr(r1);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));
    ld al1, al2;

    al1 = atan2(h, abs(l));
    al2 = atan2(h, abs(d - l));

    ld s1 = al1 * sqr(r1) - abs(l) * r1 * sin(al1);
    ld s2 = al2 * sqr(r2) - abs(d - l) * r2 * sin(al2);

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

#define int ll

typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef vector<piii> vpii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<pii> vpi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef vector<pld> vpd;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define mp(a, b) make_pair(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cout << (#x) << " = " << x << endl;
#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

istream &operator >> (istream &in, pii &a)
{
    in >> a.first >> a.second;
    return in;
}

ostream &operator << (ostream &out, pii &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) <<
               ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}

void smain();

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

#ifdef ART_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef ART_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 2100, psze = 20, oo = 2e9 + 100, B = 200, M = 1e9 + 7, g = 16, A = 26;
const ld pi = 2 * atan2(1, 0), EPS = 1e-12;

ld inter(ld d, ld r1, ld r2)
{
    if (r1 + r2 <= d)
        return 0;

    if (r1 > r2)
        swap(r1, r2);

    if (r1 + d <= r2)
        return pi * sqr(r1);

    ld l = (sqr(d) + sqr(r1) - sqr(r2)) / (2 * d);
    assert(r1 >= l);
    assert(r2 >= d - l);
    ld h = sqrt(sqr(r1) - sqr(l));
    ld al1, al2;

    if (h < EPS)
        al1 = 0;
    else
        al1 = atan2(h, l);

    if (h < EPS)
        al2 = 0;
    else
        al2 = atan2(h, d - l);

    ld s1 = al1 * sqr(r1) - l * r1 * sin(al1);
    ld s2 = al2 * sqr(r2) - (d - l) * r2 * sin(al2);

    if (l < 0)
    {
        ld ans = pi * sqr(r1);
        return pi * sqr(r1) - (s1 - s2);
    }
    else
    {
        return s1 + s2;
    }
}

void smain() {

    int x1, y1, r1;
    int x2, y2, r2;
    cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
    ld d = sqrt(sqr(x1 - x2) + sqr(y1 - y2));
    cout << inter(d, r1, r2);

//    int d, r1, R1, r2, R2;
//    cin >> d >> r1 >> R1 >> r2 >> R2;
//
//    ld ans = pi * sqr(R1) + pi * sqr(R2) - inter(d, R1, R2) - pi * sqr(r1) - pi * sqr(r2) + inter(d, r1, r2) + inter(d, r1, R2) + inter(d, R1, r2) - inter(d, r1, r2) - inter(d, r1, r2);
//    cout << ans;
}


#include <bits/stdc++.h>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	double x1, y1, r1, x2, y2, r2;
	cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
	if (r1 < r2) {
		swap(x1, x2);
		swap(y1, y2);
		swap(r1, r2);
	}
	x2 -= x1, y2 -= y1;

	double ans;
	double d = hypot(x2, y2);
	cerr << d << endl;
	if (d >= r1 + r2)
		ans = 0;
	else if (d + r2 <= r1)
		ans = PI * r2 * r2;
	else {
		// the triangle has sides: r1, r2, d.
		double s = (r1 + r2 + d) / 2.0;
		double a = sqrt(s * (s - r1) * (s - r2) * (s - d));
		double h = 2.0 * a / d;
		double b = asin(h/r1) * r1 * r1;
		double c = asin(h/r2) * r2 * r2;
		ans = b + c - 2.0 * a;
		/*
		if (d > r1)
			ans = b + c - 2.0 * a;
		else {
			ans = c - (b - 2.0 * a);
			ans = PI * r2 * r2 - ans;
		}
		*/
	}
	printf("%.10f\n", ans);
}


#include <bits/stdc++.h>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	double x1, y1, r1, x2, y2, r2;
	cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
	if (r1 < r2) {
		swap(x1, x2);
		swap(y1, y2);
		swap(r1, r2);
	}
	x2 -= x1, y2 -= y1;

	double ans;
	double d = hypot(x2, y2);
	cerr << d << endl;
	if (d >= r1 + r2)
		ans = 0;
	else if (d + r2 <= r1)
		ans = PI * r2 * r2;
	else {
		// the triangle has sides: r1, r2, d.
		double s = (r1 + r2 + d) / 2.0;
		double a = sqrt(s * (s - r1) * (s - r2) * (s - d));
		double h = 2.0 * a / d;
		double b = asin(h/r1) * r1 * r1;
		double c = asin(h/r2) * r2 * r2;
		if (d > r1)
			ans = b + c - 2.0 * a;
		else {
			ans = c - (b - 2.0 * a);
			ans = PI * r2 * r2 - ans;
		}
	}
	printf("%.10f\n", ans);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);

	long double x1, y1, r1, x2, y2, r2;
	scanf("%Lf%Lf%Lf%Lf%Lf%Lf", &x1, &y1, &r1, &x2, &y2, &r2);
	if (r1 < r2) {
		swap(x1, x2);
		swap(y1, y2);
		swap(r1, r2);
	}

	long double d = hypot(x1 - x2, y1 - y2);
	if (d + r2 <= r1) {
		printf("%.10Lf\n", PIL * r2 * r2);
		return 0;
	}
	if (r1 + r2 <= d) {
		puts("0");
		return 0;
	}

	long double x = (d*d + r1*r1 - r2*r2) / (2*d);
	long double y = sqrt(r1*r1 - x*x);
	//printf("%Lf %Lf\n", x, y);
	long double a = (y >= r1)? PIL/2 : asin(y / r1);
	long double b = (y >= r2)? PIL/2 : asin(y / r2);
	//printf("%Lf %Lf\n", a, b);
	if (d < x) b = PIL - b;
	long double ans = r1*r1*a + r2*r2*b - d*y;
	printf("%.10Lf\n", ans);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);

	double x1, y1, r1, x2, y2, r2;
	scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &r1, &x2, &y2, &r2);

	double d = hypot(x1 - x2, y1 - y2);
	if (d + min(r1, r2) <= max(r1, r2)) {
		printf("%.10f\n", PI * min(r1, r2) * min(r1, r2));
		return 0;
	}
	if (r1 + r2 <= d) {
		puts("0");
		return 0;
	}

	double x = (d*d + r1*r1 - r2*r2) / (2*d);
	double y = sqrt(r1*r1 - x*x);
	double a = asin(y / r1);
	double b = asin(y / r2);
	double ans = r1*r1*a + r2*r2*b - d*y;
	printf("%.10f\n", ans);
}


#include <bits/stdc++.h>
using namespace std;

const long double PIL = 3.141592653589793238462643383279502884L;
const long double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	long double x1, y1, r1, x2, y2, r2;
	cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
	if (r1 < r2) {
		swap(x1, x2);
		swap(y1, y2);
		swap(r1, r2);
	}
	x2 -= x1, y2 -= y1;

	long double ans;
	long double d = hypot(x2, y2);
	//cerr << d << endl;
	if (d >= r1 + r2)
		ans = 0;
	else if (d + r2 <= r1)
		ans = PI * r2 * r2;
	else {
		// the triangle has sides: r1, r2, d.
		long double s = (r1 + r2 + d) / 2.0;
		long double a = sqrt(s * (s - r1) * (s - r2) * (s - d));
		long double h = 2.0 * a / d;
		long double b = asin(h/r1) * r1 * r1;
		long double c = asin(h/r2) * r2 * r2;
		if (r1 * r1 - r2 * r2 < d * d)
			ans = b + c - 2.0 * a;
		else {
			ans = c - (b - 2.0 * a);
			ans = PI * r2 * r2 - ans;
		}
	}
	printf("%.10Lf\n", ans);
}


#include <bits/stdc++.h>
using namespace std;

//const long double PIL = 3.141592653589793238462643383279502884L;
const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define debug(v) {for (auto z : v) {cerr << z << ' ';} cerr << endl;}

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	double x1, y1, r1, x2, y2, r2;
	cin >> x1 >> y1 >> r1 >> x2 >> y2 >> r2;
	if (r1 < r2) {
		swap(x1, x2);
		swap(y1, y2);
		swap(r1, r2);
	}
	x2 -= x1, y2 -= y1;

	double ans;
	double d = hypot(x2, y2);
	//cerr << d << endl;
	if (d >= r1 + r2)
		ans = 0;
	else if (d + r2 <= r1)
		ans = PI * r2 * r2;
	else {
		// the triangle has sides: r1, r2, d.
		double s = (r1 + r2 + d) / 2.0;
		double a = sqrt(s * (s - r1) * (s - r2) * (s - d));
		double h = 2.0 * a / d;
		double b = asin(h/r1) * r1 * r1;
		double c = asin(h/r2) * r2 * r2;
		if (r1 * r1 - r2 * r2 < d * d)
			ans = b + c - 2.0 * a;
		else {
			ans = c - (b - 2.0 * a);
			ans = PI * r2 * r2 - ans;
		}
	}
	printf("%.10f\n", ans);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);

	long double x1, y1, r1, x2, y2, r2;
	scanf("%Lf%Lf%Lf%Lf%Lf%Lf", &x1, &y1, &r1, &x2, &y2, &r2);
	if (r1 < r2) {
		swap(x1, x2);
		swap(y1, y2);
		swap(r1, r2);
	}

	long double d = hypot(x1 - x2, y1 - y2);
	if (d + r2 <= r1) {
		printf("%.10Lf\n", PIL * r2 * r2);
		return 0;
	}
	if (r1 + r2 <= d) {
		puts("0");
		return 0;
	}

	long double x = (d*d + r1*r1 - r2*r2) / (2*d);
	long double y = sqrt(r1*r1 - x*x);
	long double a = asin(y / r1);
	long double b = asin(y / r2);
	if (d < x) b = PIL - b;
	long double ans = r1*r1*a + r2*r2*b - d*y;
	printf("%.10Lf\n", ans);
}


#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;

const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vii;
#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);

	long double x1, y1, r1, x2, y2, r2;
	scanf("%Lf%Lf%Lf%Lf%Lf%Lf", &x1, &y1, &r1, &x2, &y2, &r2);
	if (r1 < r2) {
		swap(x1, x2);
		swap(y1, y2);
		swap(r1, r2);
	}

	long double d = hypot(x1 - x2, y1 - y2);
	if (d + r2 <= r1) {
		printf("%.10Lf\n", PIL * r2 * r2);
		return 0;
	}
	if (r1 + r2 <= d) {
		puts("0");
		return 0;
	}

	long double x = (d*d + r1*r1 - r2*r2) / (2*d);
	long double y = sqrt(r1*r1 - x*x);
	printf("%Lf %Lf\n", x, y);
	long double a = (y >= r1)? PIL/2 : asin(y / r1);
	long double b = (y >= r2)? PIL/2 : asin(y / r2);
	printf("%Lf %Lf\n", a, b);
	if (d < x) b = PIL - b;
	long double ans = r1*r1*a + r2*r2*b - d*y;
	printf("%.10Lf\n", ans);
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    long double x,y;
};
long double dist(point a,point b)
{
    long double dx=a.x-b.x;
    long double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    long double r;
}a,b;
const long double pi=acos(-1.0);

long double yuxian(long double a,long double b,long double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

long double calarea(circle a,circle b)
{
    long double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos(yuxian(a.r,d,b.r));
        double phi2=acos(yuxian(b.r,d,a.r));
        double s1=phi1*a.r*a.r-0.5*a.r*a.r*sin(2*phi1);
        double s2=phi2*b.r*b.r-0.5*b.r*b.r*sin(2*phi2);
        return s1+s2;
    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20lf",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
long double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos(yuxian(a.r,d,b.r));
        double phi2=acos(yuxian(b.r,d,a.r));
        double s1=phi1*a.r*a.r-0.5*a.r*a.r*sin(2*phi1);
        double s2=phi2*b.r*b.r-0.5*b.r*b.r*sin(2*phi2);
        return s1+s2;
    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
long double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea()
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        return (phi1*a.r*a.r+phi2*b.r*b.r)-(0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2));

    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    double ans=calarea();
    printf("%.20f",(double)ans);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    long double x,y;
};
long double dist(point a,point b)
{
    long double dx=a.x-b.x;
    long double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    long double r;
}a,b;
const long double pi=acos(-1.0);

long double yuxian(long double a,long double b,long double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

long double calarea(circle a,circle b)
{
    long double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        long double phi1=acos(yuxian(a.r,d,b.r));
        long double phi2=acos(yuxian(b.r,d,a.r));
        long double s1=phi1*a.r*a.r-0.5*a.r*a.r*sin(2*phi1);
        long double s2=phi2*b.r*b.r-0.5*b.r*b.r*sin(2*phi2);
        return s1+s2;
    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20lf",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    long double x,y;
};
long double dist(point a,point b)
{
    long double dx=a.x-b.x;
    long double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    long double r;
}a,b;
const long double pi=acos(-1.0);

long double yuxian(long double a,long double b,long double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

long double calarea(circle a,circle b)
{
    long double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        long double phi1=acos(yuxian(a.r,d,b.r));
        long double phi2=acos(yuxian(b.r,d,a.r));
        long double s1=phi1*a.r*a.r-0.5*a.r*a.r*sin(2*phi1);
        long double s2=phi2*b.r*b.r-0.5*b.r*b.r*sin(2*phi2);
        return s1+s2;
    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
long double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        double s1=phi1*a.r*a.r+phi2*b.r*b.r;
        double s2=0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2);
        return s1-s2;
    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        return (phi1*a.r*a.r+phi2*b.r*b.r)-(0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2));

    }
}

int main() {
    scanf("%f %f %f",&a.mid.x,&a.mid.y,&a.r);
    scanf("%f %f %f",&b.mid.x,&b.mid.y,&b.r);
    printf("%.10lf",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    long double x,y;
};
long double dist(point a,point b)
{
    long double dx=a.x-b.x;
    long double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    long double r;
}a,b;
const long double pi=acos(-1.0);

long double yuxian(long double a,long double b,long double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

long double calarea(circle a,circle b)
{
    long double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos(yuxian(a.r,d,b.r));
        double phi2=acos(yuxian(b.r,d,a.r));
        double s1=phi1*a.r*a.r-0.5*a.r*a.r*sin(2*phi1);
        double s2=phi2*b.r*b.r-0.5*b.r*b.r*sin(2*phi2);
        return s1+s2;
    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
long double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        return (phi1*a.r*a.r+phi2*b.r*b.r)-(0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2));

    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.10f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        return (phi1*a.r*a.r+phi2*b.r*b.r)-(0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2));

    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        return (phi1*a.r*a.r+phi2*b.r*b.r)-(0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2));

    }
}

int main() {
    scanf("%Lf %Lf %Lf",&a.mid.x,&a.mid.y,&a.r);
    scanf("%Lf %Lf %Lf",&b.mid.x,&b.mid.y,&b.r);
    printf("%.10f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
long double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        return (phi1*a.r*a.r+phi2*b.r*b.r)-(0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2));

    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20f",calarea(a,b));
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    long double x,y;
};
long double dist(point a,point b)
{
    long double dx=a.x-b.x;
    long double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    long double r;
}a,b;
const long double pi=acos(-1.0);

long double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

long double calarea()
{
    long double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        long double phi1=acos((a.r*a.r+d*d-b.r*b.r)/(2.0*a.r*d));
        long double phi2=acos((b.r*b.r+d*d-a.r*a.r)/(2.0*b.r*d));
        return (phi1*a.r*a.r+phi2*b.r*b.r)-(0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2));

    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    double ans=calarea();
    printf("%.20f",(double)ans);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
//#define int long long
typedef long long ll;
const int maxn = 5e5 + 5;
const int inf = 0x3f3f3f3f;
struct point
{
    double x,y;
};
long double dist(point a,point b)
{
    double dx=a.x-b.x;
    double dy=a.y-b.y;
    return sqrt(dx*dx+dy*dy);
}
struct circle
{
    point mid;
    double r;
}a,b;
const double pi=acos(-1.0);

double yuxian(double a,double b,double c)
{
    return (a*a+b*b-c*c)/(2.0*a*b);
}

double calarea(circle a,circle b)
{
    double d=dist(a.mid,b.mid);
    if(d>=a.r+b.r) return 0.0;
    else if(d<=fabs(a.r-b.r)) return pi*min(a.r,b.r)*min(a.r,b.r);
    else
    {
        double phi1=acos(yuxian(a.r,d,b.r));
        double phi2=acos(yuxian(b.r,d,a.r));
        double s1=phi1*a.r*a.r+phi2*b.r*b.r;
        double s2=0.5*a.r*a.r*sin(2*phi1)+0.5*b.r*b.r*sin(2*phi2);
        return s1-s2;
    }
}

int main() {
    cin>>a.mid.x>>a.mid.y>>a.r;
    cin>>b.mid.x>>b.mid.y>>b.r;
    printf("%.20f",calarea(a,b));
    return 0;
}


#include <bits/stdc++.h>
#define PI acos(-1)
using namespace std;
const double eps = 1e-15;

bool xxx;
inline int diff(double lhs, double rhs) {
    if (lhs - eps < rhs && rhs < lhs + eps) return 0;
    return (lhs < rhs) ? -1 : 1;
}

inline bool is_between(double check, double a, double b) {
    if (a < b)
        return (a - eps < check && check < b + eps);
    else
        return (b - eps < check && check < a + eps);
}

struct Point {
    double x, y;
    bool operator==(const Point& rhs) const {
        return diff(x, rhs.x) == 0 && diff(y, rhs.y) == 0;
    }
    Point operator+(const Point& rhs) const {
        return Point{ x + rhs.x, y + rhs.y };
    }
    Point operator-(const Point& rhs) const {
        return Point{ x - rhs.x, y - rhs.y };
    }
    Point operator*(double t) const {
        return Point{ x * t, y * t };
    }
};

struct Circle {
    Point center;
    double r;
};

struct Line {
    Point pos, dir;
};

inline double inner(const Point& a, const Point& b) {
    return a.x * b.x + a.y * b.y;
}

inline double outer(const Point& a, const Point& b) {
    return a.x * b.y - a.y * b.x;
}

inline int ccw_line(const Line& line, const Point& point) {
    return diff(outer(line.dir, point - line.pos), 0);
}

inline int ccw(const Point& a, const Point& b, const Point& c) {
    return diff(outer(b - a, c - a), 0);
}

inline double dist(const Point& a, const Point& b) {
    return sqrt(inner(a - b, a - b));
}

inline double dist2(const Point &a, const Point &b) {
    return inner(a - b, a - b);
}

inline double dist(const Line& line, const Point& point, bool segment = false) {
    double c1 = inner(point - line.pos, line.dir);
    if (segment && diff(c1, 0) <= 0) return dist(line.pos, point);
    double c2 = inner(line.dir, line.dir);
    if (segment && diff(c2, c1) <= 0) return dist(line.pos + line.dir, point);
    return dist(line.pos + line.dir * (c1 / c2), point);
}

bool get_cross(const Line& a, const Line& b, Point& ret) {
    double mdet = outer(b.dir, a.dir);
    if (diff(mdet, 0) == 0) return false;
    double t2 = outer(a.dir, b.pos - a.pos) / mdet;
    ret = b.pos + b.dir * t2;
    return true;
}

bool get_segment_cross(const Line& a, const Line& b, Point& ret) {
    double mdet = outer(b.dir, a.dir);
    if (diff(mdet, 0) == 0) return false;
    double t1 = -outer(b.pos - a.pos, b.dir) / mdet;
    double t2 = outer(a.dir, b.pos - a.pos) / mdet;
    if (!is_between(t1, 0, 1) || !is_between(t2, 0, 1)) return false;
    ret = b.pos + b.dir * t2;
    return true;
}

Point inner_center(const Point &a, const Point &b, const Point &c) {
    double wa = dist(b, c), wb = dist(c, a), wc = dist(a, b);
    double w = wa + wb + wc;
    return Point{ (wa * a.x + wb * b.x + wc * c.x) / w, (wa * a.y + wb * b.y + wc * c.y) / w };
}

Point outer_center(const Point &a, const Point &b, const Point &c) {
    Point d1 = b - a, d2 = c - a;
    double area = outer(d1, d2);
    double dx = d1.x * d1.x * d2.y - d2.x * d2.x * d1.y
        + d1.y * d2.y * (d1.y - d2.y);
    double dy = d1.y * d1.y * d2.x - d2.y * d2.y * d1.x
        + d1.x * d2.x * (d1.x - d2.y);
    return Point{ a.x + dx / area / 2.0, a.y - dy / area / 2.0 };
}

vector<Point> circle_line(const Circle& circle, const Line& line) {
    vector<Point> result;
    double a = 2 * inner(line.dir, line.dir);
    double b = 2 * (line.dir.x * (line.pos.x - circle.center.x)
        + line.dir.y * (line.pos.y - circle.center.y));
    double c = inner(line.pos - circle.center, line.pos - circle.center)
        - circle.r * circle.r;
    double det = b * b - 2 * a * c;
    int pred = diff(det, 0);
    if (xxx) printf("%d %.15f\n", pred, det);
    if (xxx) printf("%.15f %.15f %.15f\n", a, b, c);
    if (pred == 0)
        result.push_back(line.pos + line.dir * (-b / a));
    else if (pred > 0) {
        det = sqrt(det);
        result.push_back(line.pos + line.dir * ((-b + det) / a));
        result.push_back(line.pos + line.dir * ((-b - det) / a));
    }
    return result;
}

vector<Point> circle_circle(const Circle& a, const Circle& b) {
    vector<Point> result;
    double aa = a.center.x * a.center.x + a.center.y * a.center.y - a.r * a.r;
    double bb = b.center.x * b.center.x + b.center.y * b.center.y - b.r * b.r;
    double tmp = (bb - aa) / 2.0;
    Point cdiff = b.center - a.center;
    if (diff(cdiff.x, 0) == 0) {
        if (diff(cdiff.y, 0) == 0) {
            return result;
        }
        return circle_line(a, Line{ Point{ 0, tmp / cdiff.y }, Point{ 1, 0 } });
    }
    if (a.center.x == 44721) printf("!\n");
    return circle_line(a,
        Line{ Point{ tmp / cdiff.x, 0 }, Point{ -cdiff.y, cdiff.x } });
}

double cs(double r, double h) {
    return r * r * h;
}

double ts(double a, double b) {
    return sqrt(a + b / 2) * sqrt(a - b / 2) * b / 2;
}

Point ret;
Circle a, b;
signed main() {
    cin>>a.center.x>>a.center.y>>a.r;
    cin>>b.center.x>>b.center.y>>b.r;
    xxx = (a.center.x == 44721);
    int pred = diff(dist(a.center, b.center), a.r + b.r);
    if (pred >= 0) return puts("0");
    auto r = circle_circle(a, b);
    double cc = dist(a.center, b.center);
    if (xxx) printf("%.15f %d\n", cc, (int) r.size());
    if(cc <= max(a.r - b.r, b.r - a.r) || !r.size())
        return printf("%.15f\n", min(a.r, b.r) * min(a.r, b.r) * PI) % 1;
    if (xxx) printf("%.15f %d\n", cc, (int) r.size());
    auto p = r.front(), q = r.back();
    double d = sqrt(abs(-cc + a.r - b.r)) * sqrt(abs(-cc - a.r + b.r)) * sqrt(-cc + a.r + b.r) * sqrt(cc + a.r + b.r) / cc;
    double sa = asin(d / 2 / a.r);
    double sb = asin(d / 2 / b.r);
    if (xxx) printf("%.15f %d\n", cc, (int) r.size());
    if(get_segment_cross(Line{a.center, b.center - a.center}, Line{p, q - p}, ret)){
        return printf("%.15f\n", cs(a.r, sa) + cs(b.r, sb) - ts(a.r, d) - ts(b.r, d)) % 1;
    }
    if (xxx) printf("%.15f %d\n", cc, (int) r.size());
    if(dist(Line{p, q - p}, a.center, true) < dist(Line{p, q - p}, b.center, true))
        return printf("%.15f\n", cs(a.r, PI - sa) + cs(b.r, sb) + ts(a.r, d) - ts(b.r, d)) % 1;
    if (xxx) printf("%.15f %d\n", cc, (int) r.size());
    return printf("%.15f\n", cs(a.r, sa) + cs(b.r, PI - sb) - ts(a.r, d) + ts(b.r, d)) % 1;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define PI (long double) acos(-1)
int x1, y1, r1;
int x2, y2, r2;

int pow(int x) { return x * x; }
int dist2(int x1, int y1, int x2, int y2) {
    return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}

long double dist(int x1, int y1, int x2, int y2) {
    return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
signed main() {
    cin>>x1>>y1>>r1;
    cin>>x2>>y2>>r2;

    int cd = dist2(x1, y1, x2, y2);
    if(pow(r1 + r2) <= cd) return puts("0");
    if(cd <= pow(r1 - r2)) {
        return printf("%.15Lf",  pow(min(r1, r2)) * PI) % 1;
    }
    long double t1 = acos((-pow(r2) + cd + pow(r1)) / (long double) sqrt(cd) / 2 / r1);
    long double t2 = acos((-pow(r1) + cd + pow(r2)) / (long double) sqrt(cd) / 2 / r2);
    printf("%.15Lf", pow(r1) * t1 + pow(r2) * t2 - r1 * r2 * sin(PI - t1 - t2)) % 1;
}


#include <bits/stdc++.h>
#define PI acos(-1)
using namespace std;
const double eps = 1e-15;

inline int diff(double lhs, double rhs) {
    if (lhs - eps < rhs && rhs < lhs + eps) return 0;
    return (lhs < rhs) ? -1 : 1;
}

inline bool is_between(double check, double a, double b) {
    if (a < b)
        return (a - eps < check && check < b + eps);
    else
        return (b - eps < check && check < a + eps);
}

struct Point {
    double x, y;
    bool operator==(const Point& rhs) const {
        return diff(x, rhs.x) == 0 && diff(y, rhs.y) == 0;
    }
    Point operator+(const Point& rhs) const {
        return Point{ x + rhs.x, y + rhs.y };
    }
    Point operator-(const Point& rhs) const {
        return Point{ x - rhs.x, y - rhs.y };
    }
    Point operator*(double t) const {
        return Point{ x * t, y * t };
    }
};

struct Circle {
    Point center;
    double r;
};

struct Line {
    Point pos, dir;
};

inline double inner(const Point& a, const Point& b) {
    return a.x * b.x + a.y * b.y;
}

inline double outer(const Point& a, const Point& b) {
    return a.x * b.y - a.y * b.x;
}

inline int ccw_line(const Line& line, const Point& point) {
    return diff(outer(line.dir, point - line.pos), 0);
}

inline int ccw(const Point& a, const Point& b, const Point& c) {
    return diff(outer(b - a, c - a), 0);
}

inline double dist(const Point& a, const Point& b) {
    return sqrt(inner(a - b, a - b));
}

inline double dist2(const Point &a, const Point &b) {
    return inner(a - b, a - b);
}

inline double dist(const Line& line, const Point& point, bool segment = false) {
    double c1 = inner(point - line.pos, line.dir);
    if (segment && diff(c1, 0) <= 0) return dist(line.pos, point);
    double c2 = inner(line.dir, line.dir);
    if (segment && diff(c2, c1) <= 0) return dist(line.pos + line.dir, point);
    return dist(line.pos + line.dir * (c1 / c2), point);
}

bool get_cross(const Line& a, const Line& b, Point& ret) {
    double mdet = outer(b.dir, a.dir);
    if (diff(mdet, 0) == 0) return false;
    double t2 = outer(a.dir, b.pos - a.pos) / mdet;
    ret = b.pos + b.dir * t2;
    return true;
}

bool get_segment_cross(const Line& a, const Line& b, Point& ret) {
    double mdet = outer(b.dir, a.dir);
    if (diff(mdet, 0) == 0) return false;
    double t1 = -outer(b.pos - a.pos, b.dir) / mdet;
    double t2 = outer(a.dir, b.pos - a.pos) / mdet;
    if (!is_between(t1, 0, 1) || !is_between(t2, 0, 1)) return false;
    ret = b.pos + b.dir * t2;
    return true;
}

Point inner_center(const Point &a, const Point &b, const Point &c) {
    double wa = dist(b, c), wb = dist(c, a), wc = dist(a, b);
    double w = wa + wb + wc;
    return Point{ (wa * a.x + wb * b.x + wc * c.x) / w, (wa * a.y + wb * b.y + wc * c.y) / w };
}

Point outer_center(const Point &a, const Point &b, const Point &c) {
    Point d1 = b - a, d2 = c - a;
    double area = outer(d1, d2);
    double dx = d1.x * d1.x * d2.y - d2.x * d2.x * d1.y
        + d1.y * d2.y * (d1.y - d2.y);
    double dy = d1.y * d1.y * d2.x - d2.y * d2.y * d1.x
        + d1.x * d2.x * (d1.x - d2.y);
    return Point{ a.x + dx / area / 2.0, a.y - dy / area / 2.0 };
}

vector<Point> circle_line(const Circle& circle, const Line& line) {
    vector<Point> result;
    double a = 2 * inner(line.dir, line.dir);
    double b = 2 * (line.dir.x * (line.pos.x - circle.center.x)
        + line.dir.y * (line.pos.y - circle.center.y));
    double c = inner(line.pos - circle.center, line.pos - circle.center)
        - circle.r * circle.r;
    double det = b * b - 2 * a * c;
    int pred = diff(det, 0);
    if (pred == 0)
        result.push_back(line.pos + line.dir * (-b / a));
    else if (pred > 0) {
        det = sqrt(det);
        result.push_back(line.pos + line.dir * ((-b + det) / a));
        result.push_back(line.pos + line.dir * ((-b - det) / a));
    }
    return result;
}

vector<Point> circle_circle(const Circle& a, const Circle& b) {
    vector<Point> result;
    double aa = a.center.x * a.center.x + a.center.y * a.center.y - a.r * a.r;
    double bb = b.center.x * b.center.x + b.center.y * b.center.y - b.r * b.r;
    double tmp = (bb - aa) / 2.0;
    Point cdiff = b.center - a.center;
    if (diff(cdiff.x, 0) == 0) {
        if (diff(cdiff.y, 0) == 0) {
            return result;
        }
        return circle_line(a, Line{ Point{ 0, tmp / cdiff.y }, Point{ 1, 0 } });
    }
    return circle_line(a,
        Line{ Point{ tmp / cdiff.x, 0 }, Point{ -cdiff.y, cdiff.x } });
}

Point ret;
Circle a, b;

double cs(double r, double h) {
    return r * r * h;
}

double ts(double a, double b) {
    return sqrt(a + b / 2) * sqrt(a - b / 2) * b / 2;
}

signed main() {
    cin>>a.center.x>>a.center.y>>a.r;
    cin>>b.center.x>>b.center.y>>b.r;
    int pred = diff(dist(a.center, b.center), a.r + b.r);
    if (pred >= 0) return puts("0");
    auto r = circle_circle(a, b);
    double cc = dist(a.center, b.center);
    if(cc <= max(a.r - b.r, b.r - a.r) || !r.size())
        return printf("%.15f\n", min(a.r, b.r) * min(a.r, b.r) * PI) % 1;
    auto p = r.front(), q = r.back();
    double d = sqrt(abs(-cc + a.r - b.r)) * sqrt(abs(-cc - a.r + b.r)) * sqrt(-cc + a.r + b.r) * sqrt(cc + a.r + b.r) / cc;
    double sa = asin(d / 2 / a.r);
    double sb = asin(d / 2 / b.r);
    if(get_segment_cross(Line{a.center, b.center - a.center}, Line{p, q - p}, ret)){
        return printf("%.15f\n", cs(a.r, sa) + cs(b.r, sb) - ts(a.r, d) - ts(b.r, d)) % 1;
    }
    if(dist(Line{p, q - p}, a.center, true) < dist(Line{p, q - p}, b.center, true))
        return printf("%.15f\n", cs(a.r, PI - sa) + cs(b.r, sb) + ts(a.r, d) - ts(b.r, d)) % 1;
    return printf("%.15f\n", cs(a.r, sa) + cs(b.r, PI - sb) - ts(a.r, d) + ts(b.r, d)) % 1;
}