Under construction

Still being built. Things may change

Largest inscribed rectangle

Interview

Time limit2sMemory limit256 MB

Summary
Given radius R and bound B, find the largest area of a rectangle inscribed in the circle whose shorter side is at most B.
Level

Easy3 of 10

Topics
Math, Geometry
Solved
No attempts yet

Problem

A rectangle is inscribed in a circle of radius RR when all four of its corners lie on the circle. Find the largest area of an inscribed rectangle whose shorter side is at most BB. A square counts as a rectangle.

Input

The first line contains an integer TT, the number of test cases (1≤T≤10001 \le T \le 1000). Each of the next TT lines contains two integers RR and BB separated by a space (1≤R,B≤100001 \le R, B \le 10000).

Output

For each test case print the maximum area on its own line, rounded to three digits after the decimal point. Always print exactly three digits after the decimal point.

Examples2

  1. Example 1

    Input
    3
    1 1
    1 2
    2 2
    
    Expected output
    1.732
    2.000
    6.928
    
  2. Example 2

    Input
    5
    3 10
    1 10000
    10000 1
    2 3
    4 5
    
    Expected output
    18.000
    2.000
    20000.000
    8.000
    31.225