There are seats in a row, with one person initially sitting in each seat. The seats are numbered from left to right. The person initially sitting in seat is called person .
The seat colors repeat in the order red, green, blue from left to right. The colors are connected by the following directed arrows.
Each person may stay in their original seat or move to a different seat satisfying both of the following conditions.
The new seat must exist, with a number between and . For example, if , person may stay in the blue seat or move to the red seat or .
A string of length specifies an additional condition for each person. Its -th character, , gives the condition for person .
F: The person must stay in their original seat.M: The person must move to a different seat.?: The person may either stay in their original seat or move to a different seat.In the final arrangement, each person must occupy exactly one seat, and each seat must contain exactly one person. All people move simultaneously. Only the final arrangement matters; the order and paths of their movements are not considered.
Represent a final arrangement by a sequence , where is the number of the person occupying seat . Two arrangements are distinct if their values of differ for at least one .
Find the number of final arrangements satisfying all the conditions.
The input is given in the following format.
For each test case, print the number of valid final arrangements modulo on one line. If no valid arrangement exists, print 0.
The two valid arrangements are and . In both arrangements, person occupies a seat other than their original one.
The first line contains the number of test cases . Each test case is given in the following format.
The first line contains the number of seats .
The second line contains the string specifying the additional condition for each person.
FM?No arrangement satisfies all the conditions.
The first test case has the following six valid arrangements.
In the second test case, the only person stays in their seat. In the third test case, there is no other seat, so the requirement to move cannot be satisfied.