# -*- coding: utf-8 -*-
#   https://www.codechef.com/problems/J7
import math
T = int(raw_input())

def solvequad(a, b, c):
    d=b*b-4*a*c
    if d<0:
        return None
    else:
        x = (-b + math.sqrt(d)) / (2 * a)
        x1 = (-b - math.sqrt(d)) / (2 * a)
        return x, x1
'''
l+b = 0.25P -h
2(lb+h(0.25P-h))=A
lb+0.25Ph-h*h=0.5A
lb=0.5A-0.25Ph+h*h
l(0.25P-h-l)=0.5A-0.25Ph+h*h
l*l-l(0.25P-h)+(0.5A-0.25Ph+h*h)
'''
def maxvol(P, A):
    h1, h2=solvequad(6, -P, A)
    #print h1, h2 

    a=1
    b=-1*(0.25*P-h1)
    c=0.5*A-0.25*P*h1+h1*h1
    l1, l2=solvequad(a,b,c)
    #print l1, l2

    a=1
    b=-1*(0.25*P-h2)
    c=0.5*A-0.25*P*h2+h2*h2
    l3, l4=solvequad(a,b,c)
    #print l3, l4
    #print l1, l2, l3, l4

    b1=0.25*P-h1-l1
    b2=0.25*P-h1-l2
    b3=0.25*P-h2-l3
    b4=0.25*P-h2-l4

    #print 'ans1',  (l1, b1, h1), (l2, b2, h2)
    #print 'ans2', (l3, b3, h2), (l4, b4, h2)

    result=max(l1*b1*h1, l2*b2*h2, l3*b3*h2, l4*b4*h2)
    print format(result, '.2f')


    #6h2-Ph+A

for _ in xrange(T):
    P, A = map(int, raw_input().split())
    maxvol(P, A)




'''
Johnny needs to make a rectangular box for his physics class project. He has bought P cm of wire and S cm2 of special paper. He would like to use all the wire (for the 12 edges) and paper (for the 6 sides) to make the box.
What is the largest volume of the box that Johnny can make?
Input

The first line contains t, the number of test cases (about 10). Then t test cases follow.
Each test case contains two integers P and S in a line (1 ≤ P ≤ 40000, 1 ≤ S ≤ 20000). You may assume that there always exists an optimal solution for the given input cases.
Output

For each test case, print a real number that is the largest volume of the box that Johnny can make, rounded to two decimal places.
Example

Input:
    2
    20 14
    20 16

    Output:
    3.00
    4.15

    Output details
    First case: the dimensions of the largest box may be 3, 1 and 1.
    Second case: the dimensions of the largest box may be 7/3, 4/3 and 4/3.
    '''