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=w[a]) dfs(rem-w[a],a+1,sum+v[a]); dfs(rem,a+1,sum); } Main(long[]v,long[]w,long ww, P[]rat){ p=rat.length; this.v=new long[p]; this.w=new long[p]; for(int i=0;iww)continue; p++; } if (p==0){ out.println(0); out.close(); return; } P[]rat=new P[p]; for(int i=0;i