#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<queue>
using namespace std;
double p,q,r;
const double eps=1e-5;
struct point{
double x;
double y;
};
double dis(point m,point n){
return sqrt((m.x-n.x)*(m.x-n.x)+(m.y-n.y)*(m.y-n.y));
}
double find2(point a,point c,point d){
point left,right;
point mid ,midmid;
double t1=0,t2;
left=c;right=d;
do
{
mid.x=(left.x+right.x)/2;
mid.y=(left.y+right.y)/2;
midmid.x=(mid.x+right.x)/2;
midmid.y=(mid.y+right.y)/2;
t1=dis(a,mid)/r+dis(mid,d)/q;
t2=dis(a,midmid)/r+dis(midmid,d)/q;
if(t1>t2)left=mid;
else right=midmid;
}
while(dis(left,right)>=eps);//必须用do-while循环,不能换为while,否则WA
return t1;
}
double find(point a,point b,point c,point d){
point left,right;
point mid,midmid;
double t1=0,t2;
left=a;right=b;
do
{
mid.x=(left.x+right.x)/2;
mid.y=(left.y+right.y)/2;
midmid.x=(mid.x+right.x)/2;
midmid.y=(mid.y+right.y)/2;
t1=dis(a,mid)/p+find2(mid,c,d);
t2=dis(a,midmid)/p+find2(midmid,c,d);
if(t1>t2)left=mid;
else right=midmid;
}
while(dis(left,right)>=eps);
return t1;
}
int main(){
int T;
cin>>T;
point a,b,c,d;
while(T--){
cin>>a.x>>a.y>>b.x>>b.y;
cin>>c.x>>c.y>>d.x>>d.y;
cin>>p>>q>>r;
printf("%.2lf\n",find(a,b,c,d));
}
return 0;
}