https://ac.nowcoder.com/acm/contest/200/E
#include<bits/stdc++.h>
#define MID (l+r)>>1
#define lson step<<1
#define rson step<<1|1
#define LL long long
using namespace std;
const int maxn=100005;
const double g=9.80665;
const double PI=3.1415926;
const double eps=0.000001;
double H,v;
int T;
double cal(double e)
{
double a1,a2,a3;
a1=v*sin(e)/g;
a2=sqrt(2*H/g+v*v*sin(e)*sin(e)/(g*g));
a3=v*cos(e);
return (a1+a2)*a3;
}
double SF(double l,double r)
{
while((r-l)>eps)
{
double mid=(l+r)/2;
double mmd=(mid+r)/2;
if(cal(mid)>cal(mmd))
r=mmd;
else
l=mid;
}
return cal(l);
}
int main()
{
//ios::sync_with_stdio(false);
cin>>T;
while(T--)
{
cin>>H>>v;
double ans=SF(0,PI/2);
printf("%.5lf\n",ans);
}
return 0;
}