Problem: You are given two circles. Find the area of their intersection.

Input

The first line contains three integers x1, y1, r1 ( - 109 ≤ x1, y1 ≤ 109, 1 ≤ r1 ≤ 109) — the position of the center and the radius of the first circle.

The second line contains three integers x2, y2, r2 ( - 109 ≤ x2, y2 ≤ 109, 1 ≤ r2 ≤ 109) — the position of the center and the radius of the second circle.

Output

Print the area of the intersection of the circles. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6.

Examples

Input

0 0 4
6 0 4


Output

7.25298806364175601379


Input

0 0 5
11 0 5


Output

0.00000000000000000000

Solution (in PYTHON):

Solution:
import math
from decimal import *

getcontext().prec = 50

E = Decimal("0."+("0"*50)+"1")

def pi():
    getcontext().prec += 2
    three = Decimal(3)
    lasts, t, s, n, na, d, da = 0, three, 3, 1, 0, 0, 24
    while s != lasts:
        lasts = s
        n, na = n+na, na+8
        d, da = d+da, da+32
        t = (t * n) / d
        s += t
    getcontext().prec -= 2
    return +s

def sin(x):
    getcontext().prec += 2
    i, lasts, s, fact, num, sign = 1, 0, x, 1, x, 1
    while s != lasts:
        lasts = s
        i += 2
        fact *= i * (i-1)
        num *= x * x
        sign *= -1
        s += num / fact * sign
    getcontext().prec -= 2
    return +s

def equal(a, b):
    return abs(a - b) <= E

def dist(a, b, c, d):
    x = a - c
    y = b - d
    return (x*x + y*y).sqrt()

def contains(a, b):
    d = dist(a[0], a[1], b[0], b[1])
    return d + b[2] < a[2] or equal(d + b[2], a[2])

def intersects(a, b):
    d = dist(a[0], a[1], b[0], b[1])
    return d - b[2] < a[2] or equal(d - b[2], a[2])

def area(a):
    return pi() * a[2] * a[2]

terms = 500
def acos(x):
    ans = x
    top = Decimal(1)
    bottom = Decimal(2)
    factor = Decimal(1) / Decimal(2)
    odd, even = 3, 4
    for i in range(1, terms):
        ans += factor * (x**odd) / odd
        factor *= odd
        factor /= even
        odd += 2
        even += 2
    return pi() / 2 - ans

def cos(x):
    return sin(pi()/2 - x)

def acosb(x):
    lo, hi = -1, -1
    dec = False
    for i in range(4):
        la = pi() / 2 * i
        ha = pi() / 2 * (i + 1)
        cl = cos(la)
        ch = cos(ha)
        if cl <= x and x <= ch:
            lo = la
            hi = ha
            break
        if ch <= x and x <= cl:
            dec = True
            lo = la
            hi = ha
            break
    for i in range(100):
        mid = (lo + hi) / 2
        if cos(mid) < x:
            if dec:
                hi = mid
            else:
                lo = mid
        else:
            if dec:
                lo = mid
            else:
                hi = mid
    return lo

def areaIntersection(a, b):
    d = dist(a[0], a[1], b[0], b[1])
    inner1 = (a[2]*a[2]+d*d-b[2]*b[2])/(2*a[2]*d)
    inner2 = (b[2]*b[2]+d*d-a[2]*a[2])/(2*b[2]*d)
    t = Decimal(acosb(inner1))
    p = Decimal(acosb(inner2))
    aa,bb = 2*t, 2*p
    saa = t*a[2]*a[2]
    sab = p*b[2]*b[2]
    taa = Decimal(.5)*a[2]*a[2]*sin(aa)
    tab = Decimal(.5)*b[2]*b[2]*sin(bb)
    return (saa+sab) - (taa+tab)

def equals(a, b):
    return equal(a[0],b[0]) and equal(a[1],b[1]) and equal(a[2],b[2])

x1,y1,r1 = map(Decimal, raw_input().split(" "))
x2,y2,r2 = map(Decimal, raw_input().split(" "))
a, b = [x1,y1,r1], [x2,y2,r2]
if b[2] > a[2]:
    c = a
    a = b
    b = c
if contains(a, b) or equals(a, b):
    print area(b)
elif not intersects(a, b):
    print 0
else:
    #print "doing it!"
    print areaIntersection(a, b)