Problem7640--[CSES Problem Set] Required Substring

7640: [CSES Problem Set] Required Substring

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 256 MiB

Description

Your task is to calculate the number of strings of length nn having a given pattern of length $m$ as their substring. All strings consist of characters A–Z.

Input

The first input line has an integer $n$: the length of the final string.
The second line has a pattern of length $m$.

Output

Print the number of strings modulo $10^9+7$.

Constraints

$1≤n≤1000$
$1 \le m \le 100$

Sample 1 Input

6
ABCDB

Sample 1 Output

52
The final string will be of the form ABCDB$x$ or $x$ABCDB where $x$ is any character between A–Z.

HINT

相同题目:CSES 1112

Source/Category