from math import sqrt
 
def largest_volume(p, s):
    sqrt_delta = sqrt(4*p*p-12*s)
    L = [(2*p+sqrt_delta)/6, (2*p-sqrt_delta)/6]
    H = [(p-2*L[0]),      (p-2*L[1])]
    V = [L[0]*L[0]*H[0],     L[1]*L[1]*H[1]]
    return max(V)
 
t = int(raw_input())
for i in range(t):
    p, s = map(int, raw_input().split())
    print '%0.2f' % largest_volume(p/4, s/2)