// Arup Guha
// 1/18/2018
// Alternate Solution (for verification) for Proposed 2018 Mercer Problem: Arena Survival

import java.util.*;

public class arena_arup {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();

		// Process each case.
		for (int loop=0; loop<nC; loop++) {

			// Get input and calculate distance between relevant circle centers.
			double r1 = stdin.nextDouble();
			double r2 = stdin.nextDouble();
			double x = stdin.nextDouble();
			double y = stdin.nextDouble();
			double d = Math.sqrt(x*x+y*y);

			// Circles are (1) possible points of new arena center (pts within r1-r2 of (0,0)
			//             (2) points with r2 of your current location.
			//             Intersection of these is your "safe" zone for the new center.
			//             Final answer is intersection divided by circle (1) area.
			double res = r2 < r1 ? area(r1-r2, r2, d)/(Math.PI*(r1-r2)*(r1-r2)) : 1;
			System.out.printf("%.2f\n", res);
		}
	}

	public static double area(double r, double s, double d) {

		// Degenerate or no triangle formed.
		if (d >= r+s) return 0;

		// Another degenerate triangle - probability is 1 here.
		if (s >= d+r) return Math.PI*r*r;

		// Last possible degenerate triangle.
		if (r >= d+s) return Math.PI*s*s;

		// Weird case where your position is in the center. Depends on which circle is bigger...
		if (Math.abs(d) < 1e-9) {
			if (s >= r) return Math.PI*r*r;
			return Math.PI*s*s;
		}

		// Use law of cosines on relevant triangle to figure out 1/2 of each sector angle.
		// Mult by 2 to get whole sector angle.
		double rAngle = 2*Math.acos((r*r+d*d-s*s)/(2*r*d));
		double sAngle = 2*Math.acos((s*s+d*d-r*r)/(2*s*d));

		// Area in curved part of r - sector minus triangle with two sides r internal angle rAngle.
		double rArea = rAngle*r*r/2 - r*r*Math.sin(rAngle)/2;

		// Same for s...
		double sArea = sAngle*s*s/2 - s*s*Math.sin(sAngle)/2;

		// Ta da!
		// Normal case.
		if (rAngle < Math.PI && sAngle < Math.PI) return rArea + sArea;

		// My area is much bigger than where the new circle could be placed.
		if (rAngle >= Math.PI)
			return rAngle*r*r/2 + r*r*Math.sin(2*Math.PI-rAngle)/2 + sArea;

		// Same situation with the circles switched.
		return sAngle*s*s/2 + s*s*Math.sin(2*Math.PI-sAngle)/2 + rArea;
	}
}