Important Test

For each variant, find the longest prefix solvable in t minutes given he may replace at most one task time with t0. Since order is fixed, choose the single task in that prefix whose copying saves the most time.

Medium4ArrayPrefix sumGreedyInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

Nick takes an important test soon. The test has nn variants, and variant ii has tasks numbered from 1 to mim_i. For every task of every variant Nick has written down the time tijt_{ij} in minutes that he needs to solve it.

The tasks must be solved in the order they appear in the variant, one after another. The answers must be submitted within the deadline of tt minutes. Nick thinks about secretly copying a solution from his notes, but he does not want to risk much, so he copies at most one solution. A task whose solution he copies costs t0t_0 minutes instead of its own time.

For each variant, find the largest number of tasks Nick can write down if he gets that variant.

Input

The first line contains three integers nn, tt and t0t_0 (1n1001 \le n \le 100, 1t100001 \le t \le 10000, 1t01001 \le t_0 \le 100): the number of variants, the length of the test, and the time needed to secretly copy one solution from the notes.

Each of the next nn lines describes one variant. The first integer on the line is the number of tasks mim_i (1mi1001 \le m_i \le 100) in variant ii, followed by mim_i integers tijt_{ij} (1tij1001 \le t_{ij} \le 100), the times needed for the tasks.

Output

For each variant print one integer on its own line: the largest number of tasks Nick can write down if he gets that variant.