import math t=int(input()) for _ in range(t): n,x=map(int,input().split()) h=list(map(int,input().split())) v=list(map(int,input().split())) for i in range(n): if v[i]==0: v[i]=1000000000000000000000 else: v[i]=1/v[i] x/=2 ans=x/v[0] currmax=v[0] for i in range(1,n): currdist=0 ans1=0 fail=0 if v[i]>currmax: currmax=v[i] currsin=v[0]/v[i] for j in range(i): theta=math.asin(currsin) currdist+=h[j]*math.tan(theta) if currdist>x: fail=1 break ans1+=h[j]/(math.cos(theta)*v[j]) currsin=currsin*v[j+1]/v[j] ans1+=(x-currdist)/v[i] if fail==0: ans=min(ans1,ans) print(2*ans)