Bobsleigh
One of the most thrilling and dramatic events at the last Winter Olympics in Vancouver was the bobsled track competition. The organizers designed the track to be extremely winding and fast. It is rumored that to achieve such high speeds, special water from various Canadian lakes was used to create the ice. This water was assessed based on specific characteristics, and a secret formula was employed to select the appropriate water for different sections of the track.
According to journalists, each of the K sections of the track was filled individually. A total of N water samples were provided for this purpose. Each sample was rated for its suitability for use in each section, with the suitability expressed as a positive integer not exceeding 10^9. Consequently, each sample had K suitability ratings. The organizers selected exactly one sample for each section of the track, and if the sum of these characteristics equaled S, the track filled with this combination of water was the fastest. Interestingly, the same water could be used for different sections of the track, but its characteristic would vary. There are several possible ways to select the water, but no one has yet determined exactly how many.
Input
The first line contains the numbers N, K, and S separated by spaces (1 ≤ N ≤ 20000, 1 ≤ S ≤ 10^9, 2 ≤ K ≤ 3). The next K lines each contain N numbers separated by spaces, representing the special characteristics of the water samples.
Output
Output a single number: the number of ways to select one sample for each section of the track.