- Time limit: 1.00 s
- Memory limit: 512 MB
You are in a book shop which sells n different books. You know the price, the number of pages and the number of copies of each book.
You have decided that the total price of your purchases will be at most x. What is the maximum number of pages you can buy? You can buy several copies of the same book.
The first input line contains two integers n and x: the number of book and the maximum total price.
The next line contains n integers h_1,h_2,\ldots,h_n: the price of each book.
The next line contains n integers s_1,s_2,\ldots,s_n: the number of pages of each book.
The last line contains n integers k_1,k_2,\ldots,k_n: the number of copies of each book.
Print one integer: the maximum number of pages.
- 1 \le n \le 100
- 1 \le x \le 10^5
- 1 \le h_i, s_i, k_i \le 1000
3 10 2 6 3 8 5 4 3 5 2
Explanation: You can buy three copies of book 1 and one copy of book 3. The price is 3 \cdot 2 + 3 = 9 and the number of pages is 3 \cdot 8 + 4 = 28.