# Solution to "The Best Box" for CodeChef
# by Peter Mattsson (quantum.caffeine@gmail.com)

import sys
from math import sqrt

def read(inFile):
    t = int(inFile.readline())
    for _ in xrange(t):
        yield [int(x) for x in inFile.readline().split()]

def write(outFile, answer):
    outFile.write("%.2f\n"%answer)

def solve(p, s):
    a = (p - sqrt(p**2 - 24*s))/12.0
    return a**3 - (p*a**2)/4 + (s*a)/2

for case in read(sys.stdin):
    write(sys.stdout, solve(*case))