// Important thing to notice is that circles could be aligned diagonally.
// In the case W=1, H=3 the optimal volume is 0.2929480435159
// and achieved when we cut rectangle into pieces (1 by x) and (1 by 3-x),
// such that two circles of diameter d are cut from (1 by x) and 1 is the height of cylinder.
// So 3-x = PI * d and d = 1 + x - sqrt(2*x).
// Here we use general formula for maximal diameter of circle such that two such circles
// could be cut from rectangle (W by H) : diam = W + H - sqrt(2 * W * H)
#include
#include
#include
using namespace std;
const double PI = 2 * acos(0.);
// Here only cut parallel to side w is considered.
// So we cut rectangle into pieces (w by x), and (w by h-x)
// Circles will be cut from (w by x), d denotes the diameter of circle
double maxV(double w, double h) {
// the case when h-x is the height of cylinder
// then PI*d<=w so circles are aligned along side w
// hence d<=x and optimal x is min(w/PI,2*h/3)
double x = min(w / PI, 2 * h / 3);
double ans = PI/4 * x * x * (h - x);
// the case when w is the height
// then we for d and x we have the following inequalities
// 0 <= x <= h, d <= w, d <= x, d <= (h-x)/PI, d <= w + x - sqrt(2 * x * w)
// (see formula above for the last inequality)
// Since the volume is PI/4 * d * d * w we should find the maximal d,
// such that there exists x satisfying all the above inequalities
// It can be proved that such d equals to max(min(w/2, h/(PI+1)), d1)
// where d1 = 0 if 2*h/(PI+1) < w and
// d1 = min(w, hp + wp - sqrt(wp * (wp + 2 * hp - w))),
// where hp = h/(PI+1) and wp = w/(PI+1)^2
double hp = h / (PI + 1);
double d = min(w / 2, hp);
if (2 * hp - w > 0) {
double wp = w / ((PI+1) * (PI+1));
d = max(d, min(w, hp + wp - sqrt(wp * (wp + 2 * hp - w))));
}
ans = max(ans, PI/4 * d * d * w);
return ans;
}
int main() {
int T;
scanf("%d", &T);
for (int t = 0; t < T; ++t) {
int w, h;
scanf("%d %d", &w, &h);
// we try both horizontal and vertical cut
double ans = max(maxV(w, h), maxV(h, w));
// .11e is scientific format with 12 exact digits in mantissa
printf("%.11e\n",ans);
}
return 0;
}