import math
t=int(raw_input())
for asd in range(t):
	p,s=map(int,raw_input().split())
	a1=(p+math.sqrt(p*p-24*s))/12
	c1=p/4-2*a1
	a2=(p-math.sqrt(p*p-24*s))/12
	c2=p/4-2*a2
	v1=a1*a1*c1
	v2=a2*a2*c2
	if (v1>v2):
		print("%.2f" % round(v1,2))
	else:
		print("%.2f" % round(v2,2))