Censorship#2461

Censorship

1 Sekunde
64 Megabyte
Leicht

Count the number of strings of length over an alphabet of symbols that do not contain any substring from a given set of "forbidden" substrings.

Eingabe

The first line contains integers (1 \leq n \leq 100) — the number of symbols in the alphabet, (1 \leq m \leq 100) — the length of the strings to generate, and (0 \leq p \leq 10) — the number of forbidden substrings. The next line contains symbols with codes greater than — the alphabet symbols. The following lines each contain a forbidden string, of length at most , consisting only of alphabet symbols.

Ausgabe

Output the answer on the first line.

Beispiele

Beispiel 1

Loading
Loading