12970 - Kcaspank Problem   

Description

There are n items. The weight and value of the i-th item are wi and vi separately.

The total weight of items you can take away is at most m. What is the maximum sum of value you can get?

Input

The first line contains two integers n, m (1 ≤ n ≤ 20, 1 ≤ m ≤ 1000) – the number of items and the totol weight you can take away.

Then n lines follow. The i+1-th line contains two integers wi, vi (1 ≤ wi ≤ 1000, 1 ≤ vi ≤ 109) – the weight and value of the i-th item.

Output

Output the maximum sum of value you can get and then output a newline('\n').

Sample Input  Download

Sample Output  Download

Tags




Discuss