#abc242e. [abc242_e](∀x∀)

[abc242_e](∀x∀)

Problem Statement

Solve the following problem for TT test cases.

Given an integer NN and a string SS, find the number of strings XX that satisfy all of the conditions below, modulo 998244353998244353.

  • XX is a string of length NN consisting of uppercase English letters.
  • XX is a palindrome.
  • XleSX \\le S in lexicographical order.
    • That is, X=SX=S or XX is lexicographically smaller than SS.

Constraints

  • 1leTle2500001 \\le T \\le 250000
  • NN is an integer between 11 and 10610^6 (inclusive).
  • In a single input, the sum of NN over the test cases is at most 10610^6.
  • SS is a string of length NN consisting of uppercase English letters.

Input

Input is given from Standard Input in the following format:

TT mathrmcase1\\mathrm{case}_1 mathrmcase2\\mathrm{case}_2 vdots\\vdots mathrmcaseT\\mathrm{case}_T

Here, mathrmcasei\\mathrm{case}_i represents the ii-th test case.

Each test case is in the following format:

NN SS

Output

Print TT lines. The ii-th line should contain the answer for the ii-th test case as an integer.


Sample Input 1

5
3
AXA
6
ABCZAZ
30
QWERTYUIOPASDFGHJKLZXCVBNMQWER
28
JVIISNEOXHSNEAAENSHXOENSIIVJ
31
KVOHEEMSOZZASHENDIGOJRTJVMVSDWW

Sample Output 1

24
29
212370247
36523399
231364016

This input contains five test cases.

Test case #1:
The 2424 strings satisfying the conditions are AAA,, ABA,, ACA,...,,..., AXA.

Test case #2:
SS may not be a palindrome.

Test case #3:
Be sure to find the count modulo 998244353998244353.