#include <cmath>#include <cstdio>double a[2002], d[2002];int main(void){ int re; int n; double s, t, ans; scanf("%d", &re); while(re--) { scanf("%d", &n); s = 0.0; for (int i = 0; i < n; i++) { scanf("%lf", &a[i]); s += a[i]; } t = 0.0; for (int i = 0; i < n; i++) { scanf("%lf", &d[i]); t += d[i]; } for (int i = 0; i < n; i++) { a[i] -= d[i] / t * s; scanf("%lf", &d[i]); } ans = -1; for (int i = 0; i < n; i++) { s = t = 0.0; for (int j = i; j < n; j++) { t = a[j] + t; s += d[j] * fabs(t); } for (int j = 0; j < i; j++) { t = a[j] + t; s += d[j] * fabs(t); } if(ans < 0 || s < ans) ans = s; } printf("%.2lfn", ans); } return 0;}