t=int(raw_input())
for i in xrange(t):
    w=raw_input().split()
    p=int(w[0])
    s=int(w[1])
    x1=p+(p*p-24*s)**(0.5)
    x2=p-(p*p-24*s)**(0.5)
    x1/=12
    x2/=12
    y1=s*x1/2 + x1**3 - p*(x1**2)/4
    y2=s*x2/2 + x2**3 - p*(x2**2)/4
    print '%.2f'%(max(y1,y2))