from sys import stdin

def findMaxVol(P, S):
	c = [(P/2.0+(P**2/4.0-6*S)**0.5)/6.0, (P/2.0-(P**2/4.0-6*S)**0.5)/6.0]
	v = [ce**3-P/4.0*(ce**2)+S/2.0*ce for ce in c]
	return max(v)

t=int(stdin.readline())
for _ in range(t):
	P, S = map(int, stdin.readline().split())
	print "%.2f"%findMaxVol(P, S)