t = input()

import math
i = 0
while i < t :
    p, s = map(int, raw_input().split())
    d = float(math.sqrt((p*p)- (24*s)))
    l = float(p +d)/12
    ld = float(p - d)/12
    h = float(p-(8*l))/4
    hd = float(p-(8*ld))/4
    if l*l*h > (ld*ld*hd) :
        print '%0.2f' % l*l*h
    else :
        print '%0.2f' % (ld*ld*hd)
    
    i = i+1