Study Group

Given students with skill values and sets of known algorithms, pick a group whose skill range is at most D to maximize (union size minus intersection size) times group size.

Hard8Bit manipulationSliding windowSortingMathNo attempts yetTime limit2sMemory limit128 MB

Problem

Hyunwoo is a first year student who enjoys studying algorithms. This time he wants to form a study group and study even harder.

Too many cooks spoil the broth, and Hyunwoo worries that a group with too many students will drag along, so he set this condition.

The skill gap between the best student and the worst student in the group must be at most DD.

He also defines the efficiency EE of a group. Let UU be the number of algorithms that at least one member knows, let II be the number of algorithms that every member knows, and let SS be the number of members. Then

E=(UI)×SE = (U - I) \times S

To check both conditions, Hyunwoo scored every student's skill as a number and, for KK important algorithms, recorded which of them each student knows. Among the subsets of students that satisfy the condition, he will pick the one with the largest efficiency as his study group.

What is the efficiency of the study group Hyunwoo will form?

Input

The first line contains the number of students NN, the number of algorithms KK, and the skill gap limit DD. (1N1051 \le N \le 10^5, 1K301 \le K \le 30, 0D1090 \le D \le 10^9)

The information of the NN students follows, two lines per student.

  • The first line contains MM, the number of algorithms this student knows, and dd, this student's skill. (0MK0 \le M \le K, 0d1090 \le d \le 10^9)
  • The second line contains the MM algorithm numbers AiA_i that this student knows. (1AiK1 \le A_i \le K) The numbers on one line are distinct. If MM is 0, this line is empty.

Output

Print the efficiency of the group with the largest efficiency on one line. A group of a single student always satisfies the condition, so the answer is never negative.