Group Knapsack Problem

Have N Group items and a capacity are V Backpack.

There are several items in each group, and only one item in the same group can be selected. The volume of each item isvi j, The value is wi j,among them i Is the group number,j Is the number in the group.

Solve which items are loaded into the backpack, so that the total volume of the items does not exceed the capacity of the backpack, and the total value is the largest.

Output the maximum value.

Input format There are two integers in the first line N, V, Separated by spaces, respectively indicate the number of item groups and the capacity of the backpack.

Next there is N Group data:

There is an integer in the first row of each group of data Si, Said the first i The number of items in each item group;
Next to each set of data Si Rows, each row has two integers vi j,wi j, Separated by spaces, indicating the first i Item group j The volume and value of each item;

Output format Output an integer that represents the maximum value.

data range 0 < N, V≤ 100 0 <Si≤ 100 0 <vi j,wi j≤ 100

Sample Input:

3 5
2
1 2
2 4
1
3 4
1
4 5

Sample Output:

8