Help Sunny Sir!

All submissions for this problem are available.
The End Terminal Exams are only a few weeks away and Sunny sir is quite tensed because a major portion of Physics has still been left to cover up!! He still has N units to finish. Since the exam pattern is always fixed in IPU, each unit has different priorities associated with it. For example, he knows that a question on Maxwell Equations or Skin Depth from Unit 1, Davison Germer Experiment from Modern Physics and Derivations from Relativity are sure shot questions. Let's say Array A_{i} denotes the importance of ith unit. Each Unit A_{i} requires an investment of T_{i} hours of time. There are only at most W hours sir can devote to his class because now he is married so he got other responsibilities towards his family! Now he wants to decide how to make his students score well by carefully choosing which units to teach such as to maximize the important topics coverage in at most W hours of time. Can you help Sunny Sir to find out the sum of all the important units he can cover? :)
See Sample Input/Output for further details/clarification.
Input
 The first line of input contains an integer T followed two integers in the next line N and W denoting the number of units left to cover up and number of hours sir can devote respectively.The second line contains N spaceseparated integers A_{1}, A_{2}, ..., A_{N} denoting the importance/weightage of the A[i]th unit.
The third and the last line contains N spaceseparated integers T_{1}, T_{2}, ..., T_{N} denoting the amount of hours required to complete ith unit.
Output
 For each test case, output a single line containing the sum of all the important units he can cover in at most given time.
Constraints
Should contain all the constraints on the input data that you may have. Format it like:
 1 ≤ N ≤ 100
 1 ≤ A[i] ≤ 10^{5}
 1 ≤ T[i] ≤ 10^{5}
Example
Input: 1 5 15 3 6 2 1 9 5 3 6 2 9 Output: 16
Explanation
Example case 1. Out of all the optimal possible combinations, the most important topics that can be covered with maximum weightage are 1st, 3rd and 5th topic (i.e A[0],A[3] & A[4] ) by spending 9+3+2 hours (i.e T[1],T[4] & T[5]) which is less than equal to W(i.e 15)
Author:  shivam_ait 
Tags  shivam_ait 
Date Added:  10072015 
Time Limit:  1 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 