import math
t = input()
while(t>0):
	p,s = raw_input().split()
	p = int(p) #inner radii
	s = int(s) #outer radii
	h = (p - math.sqrt(p*p-24*s))/12
	max = h*h*h+(s*h)/2-(p*h*h)/4
	print format(max, '.2f')
	t -= 1