from math import sqrt

def calc(p, s):
    sq = sqrt(p*p - 24*s)
    a = (p + sq)/12.0
    b = (p - sq)/12.0
    c = (p - 8*a)/4.0
    d = (p - 8*b)/4.0
    V1 = a*a*c
    V2 = b*b*d
    return max(V1,V2)

t = int(raw_input())
for i in range(t):
    x = raw_input()
    p, s = x.split()
    p = int(p)
    s = int(s)
    print '%0.2f' % calc(p, s)