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 D.
He also defines the efficiency E of a group. Let U be the number of algorithms that at least one member knows, let I be the number of algorithms that every member knows, and let S be the number of members. Then
E=(U−I)×S
To check both conditions, Hyunwoo scored every student's skill as a number and, for K 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?