创建于 2026/07/16 · 更新于 2026/07/16
There are people standing in a line, and at least one of them is evil.
Each person has a status: evil or non-evil. Each person also gives a piece of information, saying whether the nearest evil person to them is on their left or on their right. If the nearest evil people on both sides are at the same distance, the person will say "left". In particular, if a person is evil, they may give arbitrary information.
However, the information given by some people is uncertain.
You need to determine the number of possible scenarios. Two scenarios are considered different if and only if there exists at least one person whose status differs, or whose given information differs.
The first line contains an integer (), denoting the number of people.
The second line contains a string of length . Each character of is one of the following:
Print a single integer - the answer modulo .
3
L??
9
5
?LR??
57