#include #include #include #include #include #define INF 2140000000 using namespace std; void solve() { int n, x; cin >> n >> x; vector h(n), a(n); int i, j; int preh = 0; for (i = 0; i < n; i++) { int curh; cin >> curh; h[i] = curh - preh; preh = curh; } for (i = 0; i < n; i++) { cin >> a[i]; } double ans = (double)x * a[0]; int mina = INF; for (i = 0; i < n; i++) { if (a[i] < mina) { double sumdist = 0; double sumtime = 0; for (j = 0; j < i; j++) { double sint = (double)a[i] / a[j]; double cost = sqrt(1 - sint * sint); double dist = sint/cost * h[j]; sumdist += dist; sumtime += (double)h[j] / cost * a[j] * 2; } if (sumdist * 2 < x) { ans = min(ans, sumtime + (x - sumdist * 2) * a[i]); } } mina = min(mina, a[i]); } cout << setprecision(10) << ans << endl; return; } int main() { int T, t; cin >> T; for (t = 0; t < T; t++) { solve(); } return 0; }