- Time limit: 1.00 s
- Memory limit: 512 MB
Your task is to find out the maximum total weight of the ice cream. Note that Uolevi may also buy two similar portions.
The first input line contains two integers $n$ and $x$: the number of choices, and the money Uolevi has.
After this, the input contains $n$ lines. Each line describes one choice and contains two integers $h$ and $p$: the price and weight of the choice.
You can assume that there is at least one solution.
You should print one integer: the maximum total weight.
Explanation: Uolevi buys portions with prices 1 and 9.
Explanation: Uolevi buys two portions with price 3.
- $1 \le n \le 100$
- $1 \le x,h,p \le 1000$
You will get 100 points for the task if your program produces a correct answer for each test case, and otherwise you will get 0 points.