#include <bits/stdc++.h> void solve() { int n; std::cin >> n; std::vector<double> a(n + 1, 0); std::vector<double> b(n + 1, 0); std::vector<double> dp(n + 1, 0); for (int i = 1; i <= n; i++) { std::cin >> a[i]; } for (int i = 1; i <= n; i++) { std::cin >> b[i]; } dp[n] = (a[n] + b[n]) / 2; for (int i = n - 1; i > 0 ; i--) { dp[i] = (std::min(a[i], dp[i + 1]) + std::min(b[i], dp[i + 1])) / 2; } std::cout << dp[1] << "\n"; } int main() { std::ios::sync_with_stdio; std::cout.tie(0),std::cin.tie(0); std::cout << std::fixed << std::setprecision(10) << "\n"; int t; std::cin >> t; while (t--) solve(); }