Easy Problemset

Simulate judges proposing problems in turn and keep each proposal whose hardness reaches the running total until k problems are chosen.

Easy2SimulationInterviewNo attempts yetTime limit1sMemory limit256 MB

Problem

One of the hardest parts of preparing an ACM ICPC contest is building a problemset with a reasonable number of easy problems. At the Not Easy European Regional Contest the jury does it as follows.

There are nn jury members, numbered from 1 to nn. Before the meeting, judge ii prepared pip_i easy problems. Each of those problems has a hardness between 0 and 49, and a larger value means a harder problem. Every judge also knows a practically infinite supply of hard problems, whose hardness is 50. During the meeting the judges pick kk problems for the contest.

The judges propose problems in increasing order of their numbers. Judge 1 takes the first problem from the list of easy problems he has not proposed yet, or a hard problem if he has already proposed all of them, and proposes it. The proposed problem is selected for the contest if its hardness is greater than or equal to the total hardness of the problems selected so far, and otherwise it is considered too easy and dropped. Judge 2 then does the same, and after judge nn the turn returns to judge 1. The procedure stops as soon as kk problems are selected.

If every judge has proposed all of his easy problems and fewer than kk problems are selected, the judges fill the remaining slots with hard problems regardless of the total hardness.

Compute the total hardness of the problemset the judges built.

Input

The first line contains the number of judges nn and the number of problems kk (2n102 \le n \le 10, 8k148 \le k \le 14). Each of the next nn lines describes the problems prepared by one judge, in order of judge number. Line ii starts with pip_i (1pi101 \le p_i \le 10), followed by pip_i integers between 0 and 49, the hardnesses of the problems prepared by judge ii in the order they will be proposed.

Output

Print one integer, the total hardness of the selected problems.

Hint

In the first example, three problems with hardnesses 0, 1 and 1 are selected first. Judge 1 then proposes the problem with hardness 3 and it is selected, while the problem with hardness 1 proposed by judge 2 is too easy. Next the problems with hardnesses 5, 12 and 23, proposed by judges 3, 1 and 2, are selected. The following three proposals with hardnesses 17, 1 and 20 are rejected, and the problemset is completed by the hardness 49 problem of judge 3. The total hardness is 94.

In the second example, three problems with hardnesses 1, 1 and 2 are selected first. The second problem of judge 1 has hardness 3 and is too easy. Judge 2 has run out of easy problems, so he proposes a problem with hardness 50 and it is selected. The hardness 5 problem of judge 3 is rejected. The remaining six slots are filled with hard problems, so the total hardness is 54+6×50=35454 + 6 \times 50 = 354.