|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||9||5||5||55.556%|
Guess what?! Dalia won the money (an amount X), and now it’s time to spend it. Mohamed Fouad is the deputy regional contest director and he wants to spend the money but he doesn’t know what to spend it on. There are N items that he can buy like name-tags, T-shirts, helium balloons, trophies, etc. each having a different importance value and a cost to buy one unit from (you can buy as much units of any item as you want as long as you don't exceed the budget).
Mohamed wants your help; tell him the maximum importance value he can get after he chooses optimally to buy any number of items without exceeding his budget.
The first line of input contains an integer T, the number of test cases. T test cases follow, the first line of each test case contains two integers (1 ≤ N ≤ 100), (1 ≤ X ≤ 10000). The second line of the test case contains N space separated integers Ii (1 ≤ Ii ≤ 400000), each representing the importance value Fouad earns from item i (0 ≤ i < N). The following line contains N space separated integers Ci (1 ≤ Ci ≤ 1000), each representing the cost of an item i (0 ≤ i < N).
For each test case, on a separate line, output the maximum importance value Fouad can get.
1 5 20 1 2 3 4 5 2 6 3 5 4