P28482 [洛谷] [CTS2019] Repetition
省选
题目描述

Background

Jia Zhangke said in "Mountains May Depart" that "life is repetition." In life, people always enjoy repeating what they have done. Language is a classic example of this.

For instance, when expressing a question, a single question mark "?" is often not enough; a series of question marks "????" seems more powerful.

When expressing an apology, a simple "sorry" often feels insincere; repeating it as "sorry sorry" adequately conveys sincerity.

Problem Description

Country A is a nation that loves repetition. In this country, a basic sentence can be represented by a lowercase letter string of exactly length $m$. To express their love for repetition, the people of Country A always repeat the sentence infinitely many times.

Sometimes, such repetition is meaningful. The people of Country A consider a lowercase letter string that is lexicographically smaller than a given string $s$ and has the same length as $s$ to be a meaningful semantic fragment. They want to know how many different basic sentences (i.e., lowercase letter strings of exactly length $m$) can be found in the infinite repetition, such that at least one meaningful semantic fragment can be identified?

Input Format

The first line of the input file is a positive integer $m$, representing the length of the basic sentence. The second line is a lowercase letter string $s$, the details of which are described in the problem statement.

Output Format

Output a single integer, which is the number of basic sentences that meet the conditions. To avoid excessively large answers, you only need to output the result modulo $998244353$.

Sample Input and Output

Sample Input #1

3
abc

Sample Output #1

79

Sample Input #2

5
zxcvb

Sample Output #2

11881375

Sample Input #3

20
uuopacpertklmqwbfixc

Sample Output #3

765676850

Notes

Let the length of string $s$ be $n$. Then the ranges of $n$ and $m$ follow the table below:

img

For $100\%$ of the data, it is guaranteed that $1 \le n, m \le 2000$.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 abc
样例输出
79