Problemas
It's the year
Choose a position
Farmer John gives Bessie a string
Help Bessie count the number of distinct ways for the number line to be colored while satisfying Farmer John's preferences. Two colorings are different if there is at least one corresponding point with a different color. Because the answer may be large, output it modulo
Entrada
The first line contains an integer
The following line contains string
Salida
Output the number of distinct ways for the number line to be colored while satisfying Farmer John's preferences modulo
Subtarea
| # | Puntaje | Condición |
|---|---|---|
| #1 | 10 | |
| #2 | 20 | |
| #3 | 30 | All but at most |
| #4 | 40 | No additional constraints |
Ejemplo #1
6
RXXXXB
5
Bessie can choose
The other colorings are
Ejemplo #2
6
XXRBXX
6
The six colorings are
Ejemplo #3
12
XBXXXXRXRBXX
18