import math
t=  int(raw_input())
for _ in xrange(t):
	p,s = map(float, raw_input().split())
	val  = math.sqrt((p*p)-(24*s))
	l1 = (p + val)/12.0
	l2 = (p -val)/12.0
	if l1 <0:
		ans = l2
		print "%.2f" %ans*ans*((p/4.0)-(2*ans))
	elif l2<0:
		ans =l1
		print "%.2f" %ans*ans*((p/4.0)-(2*ans))
	else:
		print "%.2f" %max(l1*l1*((p/4.0)-(2*l1)), l2*l2*((p/4.0)-(2*l2)))