#P4052. [JSOI2007] 文本生成器

    ID: 2950 远端评测题 1000ms 128MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划,dp2007各省省选江苏O2优化AC 自动机

[JSOI2007] 文本生成器

Description

JSOI assigned team member ZYX a task to develop a computer program called "Text Generator." The users of this software are young children, and they are currently using the GW Text Generator v6.

This software can randomly generate some text — it always generates a text with fixed length and completely random characters. That is, each character in the generated text is completely random. If a text contains at least one word known by the users, then we say the text is readable (we say a text ss contains a word tt if and only if tt is a substring of ss). However, even under such a standard, the texts generated by the current GW Text Generator v6 are almost entirely unreadable. ZYX needs to determine, among all texts generated by GW Text Generator v6, how many are readable, in order to successfully obtain the v7 update. Can you help him?

Output the answer modulo 104+710^4 + 7.

Input Format

The first line contains two integers, denoting the total number of words known by the users nn and the length of the generated text mm.

The next nn lines each contain a string sis_i, representing a word known by the users.

Output Format

Output a single integer: the answer modulo 104+710^4 + 7.

2 2
A
B

100

Hint

Constraints and Conventions

For all test points, it is guaranteed that:

  • 1n601 \leq n \leq 60, 1m1001 \leq m \leq 100.
  • 1si1001 \leq |s_i| \leq 100, where si|s_i| denotes the length of string sis_i.
  • Each sis_i contains only uppercase English letters.

Translated by ChatGPT 5