package test;
import java.util.Scanner;
public class Main {
public static double cal(double n,double x,double vx,double y,double vy,double mid) {
double l1 = Math.min((mid-x + mid)/vx,(x*2 + mid-x)/vx);
double l2 = Math.min((y-mid + n - mid)/vy,(n-y + n-mid)/vy);
return Math.max(l1,l2);
}
public static void main(String[] arg) {
Scanner input = new Scanner(System.in);
int caset = input.nextInt();
double eps = 0.00001;
while(caset > 0) {
caset--;
double n = input.nextDouble();
double x = input.nextDouble();
double vx = input.nextDouble();
double y = input.nextDouble();
double vy = input.nextDouble();
if(x > y) {
double c = x;
double vc = vx;
x = y;
vx = vy;
y = c;
vy = vc;
}
double t1 = Math.max((n-x)/vx,y/vy);
double t2 = (x + n-y + n)/(vx + vy);
double t3 = Math.min((Math.min(x,n-x) + n)/vx,(Math.min(y,n-y) + n)/vy);
double l = x;
double r = y;
while(r - l > eps) {
double mid = (l+r)/2;
if(cal(n,x,vx,y,vy,mid-eps) < cal(n,x,vx,y,vy,mid+eps)) r = mid;
else l = mid;
}
double mid = (l+r)/2;
double ans = Math.min(t1,t2);
ans = Math.min(ans,t3);
ans = Math.min(ans,cal(n,x,vx,y,vy,mid));
System.out.printf("%.5f\n",ans);
}
}
}