#include typedef long long ll; typedef struct{ll v,w,t,u;}S; int n; ll c; ll b; S ss[6000]; void ha(){ printf("%lld\n",b); exit(0); } int sgn(double a){ return a<0?-1:a>0; } int cmp(void*a,void*b){ S*p=a,*q=b; return sgn((double)q->v/q->w-(double)p->v/p->w); } void dfs(int i,ll v,ll c){ if(i==n){ if(b=ss[i].w){ dfs(i+1,v+ss[i].v,c-ss[i].w); } if(c