Censorship
Determine the number of strings of length m that can be formed using an alphabet of n symbols, such that none of these strings contain any of the specified "forbidden" substrings.
Input
The first line contains three integers: n (1 ≤ n ≤ 100), representing the number of symbols in the alphabet; m (1 ≤ m ≤ 100), indicating the length of the strings to be generated; and p (0 ≤ p ≤ 10), which is the number of "forbidden" substrings. The second line lists n symbols, each with a code greater than 32, which make up the alphabet. Following this, there are p lines, each containing one "forbidden" string. The length of each forbidden string does not exceed min(m, 10) symbols, and they are composed solely of the alphabet symbols.
Output
Output the number of valid strings on the first line.