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 JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.math.*;

public class CF600D {
	// https://en.wikipedia.org/wiki/Taylor_series
	static double x_sinx(double x) {
		double sum = 0, p = x, q = 1;
		for (int i = 1; i <= 5; i++) {
			p *= x * x;
			q *= 2 * i;
			q *= 2 * i + 1;
			sum += p / q;
		}
		return sum;
	}
	static double atan(double x) {
		double sum = 0, p = x, q;
		for (int i = 0; i < 5; i++) {
			q = 2 * i + 1;
			sum += p / q;
			p *= x * x;
		}
		return sum;
	}
	static double theta(long dd, long r1, long r2) {
		long rr1 = r1 * r1;
		long rr2 = r2 * r2;
		BigInteger p = BigInteger.valueOf(4);
		p = p.multiply(BigInteger.valueOf(dd));
		p = p.multiply(BigInteger.valueOf(rr1));
		BigInteger q = BigInteger.valueOf(dd);
		q = q.add(BigInteger.valueOf(rr1));
		q = q.subtract(BigInteger.valueOf(rr2));
		q = q.multiply(q);
		p = p.subtract(q);
		double x = Math.sqrt(p.doubleValue() / q.doubleValue());
		return x < 1e-3 ? atan(x)
			: Math.acos((dd + rr1 - rr2) / (2 * Math.sqrt(dd) * r1));
	}
	static double cap(long r, double a) {
		return r * r * (a < 1e-3 ? x_sinx(a) : a - Math.sin(a)) / 2;
	}
	static double area(long x1, long y1, long r1, long x2, long y2, long r2) {
		double d = Math.hypot(x1 - x2, y1 - y2);
		if (d > r1 + r2 - 1e-6)
			return 0;
		if (d < Math.abs(r1 - r2) + 1e-6) {
			long r = Math.min(r1, r2);
			return Math.PI * r * r;
		}
		long x12 = x1 - x2;
		long y12 = y1 - y2;
		long dd = x12 * x12 + y12 * y12;
		double theta1 = theta(dd, r1, r2) * 2;
		double theta2 = theta(dd, r2, r1) * 2;
		return cap(r1, theta1) + cap(r2, theta2);
	}
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int x1 = Integer.parseInt(st.nextToken());
		int y1 = Integer.parseInt(st.nextToken());
		int r1 = Integer.parseInt(st.nextToken());
		st = new StringTokenizer(br.readLine());
		int x2 = Integer.parseInt(st.nextToken());
		int y2 = Integer.parseInt(st.nextToken());
		int r2 = Integer.parseInt(st.nextToken());
		System.out.println(area(x1, y1, r1, x2, y2, r2));
	}
}