import java.io.*; import java.util.*; final class P implements Comparable
{
double a;
long b;
P(double x,long y){a=x;b=y;}
@Override
public int compareTo(P o){
return Double.compare(a,o.a);
}
}
class Main {
long ans=0;
int p;
long[]v,w,vAcc,wAcc;
void dfs(long rem,int a,long sum){
ans=Math.max(ans,sum);
if(a>=p)
return;
if(wAcc[p]-wAcc[a]<=rem){
ans=Math.max(ans,vAcc[p]-vAcc[a]+sum);
return;
}
double expect=(double)(vAcc[p]-vAcc[a])*(double)w[a]/(double)v[a];
if(sum+expect ww)continue;
p++;
}
if (p==0){
out.println(0);
out.close();
return;
}
P[]rat=new P[p];
for(int i=0;i