#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const double eps=1e-9;
const double pie=3.1415926535;
int T;
double br,tr,H,v;
double getV(double h)
{
double rr=(tr-br)*h/H+br; //相似三角形
return pie*h*(br*br+rr*rr+br*rr)/3;
}
int main()
{
cin>>T;
while(T--)
{
cin>>br>>tr>>H>>v;
//二分查找水的高度
double l=0,r=H;
while(r-l>eps)
{
double mid=(l+r)/2,curV=getV(mid);
if(fabs(curV-v)<= eps)
break;
else if(curV>v)
r=mid;
else
l=mid;
}
printf("%.6lf
",l);
}
return 0;
}