#5662. CSES1112 所需子串
0
CSES1112 所需子串
Required Substring
Your task is to calculate the number of strings of length n 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
Example
Input
6
ABCDB
Output
52
Explanation: The final string will be of the form ABCDBx or xABCDB where x is any character between A–Z.