import math
trials = int(raw_input())
for i in xrange(trials):
    p, s = map(int,raw_input().split())
    ya0 = p/4
    ya1 = -2
    b=4*ya0
    a=-6
    c=-s
    x_0 = (-b+math.sqrt(math.pow(b,2)-4*a*c))/(2*a)
    x_1 = (-b-math.sqrt(math.pow(b,2)-4*a*c))/(2*a)
    y_0 = ya0+ya1*x_0
    y_1 = ya0+ya1*x_1
    print("%.2f" % max(x_0*x_0*y_0, x_1*x_1*y_1))