#!/usr/bin/python
import math


def main():
    num_times = int(raw_input())
    for i in xrange(0, num_times):
        P, S = map(int, raw_input().split())
        l1 = ((P/2) + math.sqrt(math.pow(P/2, 2) - 6*S))/6
        l2 = ((P/2) - math.sqrt(math.pow(P/2, 2) - 6*S))/6
        h1 = P/4 - 2*l1
        h2 = P/4 - 2*l2
        v = max(h1 * math.pow(l1, 2), h2 * math.pow(l2, 2))
        print "%.2f" % v

if __name__ == "__main__":
    main()