#include #include #include #include using namespace std; int N,v[100],w[100],V; int rec(int i,int j){ int res; if(i == N) res = 0; else if(j < w[i]) res = rec(i+1,j); else res = max(rec(i+1,j),rec(i+1,j-w[i]) + v[i]); return res; } int main(){ bool flag1= true,flag2=false,flag3=false,flag4 = true; int sum = 0; cin >> N; for(int i = 0;i < N;++i) cin >> v[i] >> w[i]; cin >> V; for(int i = 0 ;i < N;++i){ sum += v[i]; } for(int i = 1; i < 100000;++i){ if(rec(0,i) == V && flag1 == true){ cout << i <