- Time limit: 1.00 s
- Memory limit: 512 MB
Your task is to calculate the number of strings of length having a given pattern of length as their substring. All strings consist of characters A–Z.
Input
The first input line has an integer : the length of the final string.
The second line has a pattern of length .
Output
Print the number of strings modulo .
Constraints
Example
Input:
6 ABCDB
Output:
52
Explanation: The final string will be of the form ABCDB or ABCDB where is any character between A–Z.