Kangho's company has N employees and M jobs to finish. Employees are numbered 1 to N, and jobs are numbered 1 to M.
Each employee has a fixed list of jobs they can do. Every job is handled by exactly one person, and an employee normally takes only one job from that list. An employee who received X penalty points last month takes at most X+1 jobs.
Suppose there are three employees, and last month Minho (employee 1) received 2 points, Jaepil (employee 2) received 1 point, and Juhyun (employee 3) received 0 points. Then Minho takes at most 3 jobs, Jaepil at most 2 jobs, and Juhyun at most 1 job.
No employee knows their own score. Only K, the sum of the penalty points over all employees, is known. Kangho uses that: he splits the K points among the employees however he likes, so that as many jobs as possible get done. The points given to one employee form a non-negative integer, and the points sum to exactly K.
For example, employee 1 can do jobs 1, 2, 3, 4, 5, employees 2, 3, and 4 can do only job 1, and employee 5 can do jobs 1 and 5. With K=2, giving 1 point to employee 1 and 1 point to employee 5 gets four jobs done. Giving both points to employee 1 instead lets employee 1 take three jobs, so employee 1 takes jobs 2, 3, 4, employee 2 takes job 1, and employee 5 takes job 5, which finishes all five.
Given the job list of every employee and the penalty sum K, write a program that finds how many of the M jobs can be done at most.
The first line contains the number of employees N, the number of jobs M, and the penalty sum K, separated by spaces. (1≤N,M≤1000, 1≤K≤N)
Each of the next N lines describes one employee. Line i contains the number of jobs employee i can do, followed by those job numbers, separated by spaces. The count is between 0 and M, and no number appears twice on the same line.
Print the largest number of jobs Kangho's company can finish.