Today you will attend n lectures, and in the i-th lecture, you can gain ai knowledge.
To enhance the effect of studying, you can meditate before a lecture — in this case, you will receive double the amount of knowledge for that lecture.
Unfortunately, you cannot meditate before two consecutive lectures — the effect will be significantly weakened.
Calculate the maximum amount of knowledge you can gain from all the lectures by meditating at optimal times.
The first line contains an integer n
— the number of lectures.
The second line contains n integers a1, a2, ..., an
— the amount of knowledge you will gain by default from the j-th lecture.
In the first line, output an integer k — the maximum possible total amount of knowledge you can gain in a day.
In the second line, output n characters s1s2... sn, where the character sj = M if you meditated before the j-th lecture, and sj = O if you attended the lecture without meditating.
The characters M and O are uppercase Latin letters.
If there are multiple valid answers with the optimal amount of knowledge, output any.
6
1 8 1 1 5 2
31
OMOOMO
7
2 4 2 3 5 4 5
39
MOMOMOM
First test example
You decided to meditate before the 2-nd and 5-th lectures — you gained a total of 1 + 8·2 + 1 + 1 + 5·2 + 2 = 31.
Second test example
In this case, you meditated before each odd lecture — the total came to 2·2 + 4 + 2·2 + 3 + 5·2 + 4 + 5·2 = 39.
Note that you could not meditate before both the 5-th and 6-th lectures.
| Name |
|---|


