33OJ
登录 注册

#ABC479C. 便当装盒 / Bento Packing

便当装盒 / Bento Packing

Problem Statement

There are NN side dishes.

The ii-th side dish has a deliciousness of AiA_i and a volume of BiB_i.

You will choose some of the side dishes so that the total volume of the chosen dishes is at most WW, and pack them into a lunch box.

Find the maximum possible total deliciousness of the chosen side dishes.

Constraints

  • 1≤N≤201 \leq N \leq 20
  • 1≤W≤1091 \leq W \leq 10^9
  • 1≤Ai,Bi≤1091 \leq A_i, B_i \leq 10^9
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

  • NN WW
  • A1A_1 B1B_1
  • A2A_2 B2B_2
  • ⋮\vdots
  • ANA_N BNB_N

Output

Output the answer.

4 13
4 5
3 3
5 9
8 6
12

If you pack the 11-st and 44-th side dishes into the lunch box, the total deliciousness is 1212 and the total volume is 1111.

3 99
1 100
10 100
100 100
0

You may also pack no side dishes.

5 9
6 4
9 1
2 1
4 3
5 4
21