1 #include<cstring>
2 #include<cstdio>
3 #include<cmath>
4 #include<iostream>
5 #include<algorithm>
6 #define AA struct ss
7 using namespace std;
8
9 int n;
10 AA {
11 double b,w,d,h;
12 }re[50005];
13
14 double P(double k)
15 {
16 double ans=0;
17 for(int i=0;i<n;i++)
18 {
19 if(k>=re[i].b)
20 {
21 ans+=min(k-re[i].b,re[i].h)*re[i].w*re[i].d;
22 }
23 }
24 return ans;
25 }
26
27 int main()
28 {
29 int T;
30 scanf("%d",&T);
31 while(T--)
32 {
33 double r=0,l=0;
34 double sum=0;
35 scanf("%d",&n);
36 for(int i=0;i<n;i++)
37 {
38 scanf("%lf%lf%lf%lf",&re[i].b,&re[i].h,&re[i].w,&re[i].d);
39 sum+=re[i].h*re[i].w*re[i].d;
40 l=max(l,re[i].b+re[i].h);
41 }
42
43 double v;
44 scanf("%lf",&v);
45 if(sum<v) {printf("OVERFLOW
");continue;}
46
47 while(r+0.0001<l)
48 {
49 double mid=(r+l)/2.0;
50 if(P(mid)<v) r=mid;
51 else l=mid;
52 }
53
54 printf("%.2lf
",l);
55
56 }
57 }