test_case = int(raw_input())
for t in range(test_case):
    p, s = map(float, raw_input().split())
    a1 = (p+ (p**2 - 24*s)**0.5)/12.0
    a2 = (p- (p**2 - 24*s)**0.5)/12.0
    print "%.2f"%round(max( s*a1/2 - p*a1*a1/4 + a1*a1*a1, s*a2/2 - p*a2*a2/4 + a2*a2*a2), 2) ## print fixed digits after decimal