Begimai returned home after the competition — and she was greeted by her very happy younger sister Dinara.
Dinara said that she had been closely following the competition — and even came up with a way to solve a challenging problem!
The only thing Dinara was still unsure about was how efficient her proposed solution was. Therefore, Dinara prepared pseudocode of her solution for Begimai to evaluate.
Dinara's pseudocode consists of a combination of three types of operators:
Now Begimai must determine the total number of operations performed by this solution and draw a conclusion about its efficiency.
Begimai immediately saw that the final total number of operations was simply enormous — and to avoid upsetting her sister too much, she decided to tell her the remainder of this number when divided by $$$10^9 + 7$$$.
The first line contains an integer $$$n$$$ $$$(1 \le n \le 10^5)$$$ — the number of lines in the pseudocode of the solution.
Each of the following $$$n$$$ lines contains one of three operators:
It is guaranteed that
Let $$$T$$$ be the total number of operations performed by the described solution.
In this case, output a single integer — the remainder of $$$T$$$ when divided by $$$10^9 + 7$$$.
13for 10for 300calc 5endfor 40calc 7calc 4endendcalc 45for 3calc 123end
19814
7for 2000for 1000for 3000calc 4000endendend
999832007
First test example
Decomposing the presented pseudocode:
In total, $$$T = 19400 + 45 + 369 = 19814$$$ operations.
Second test example
In total, this solution performs $$$T = 2000 \cdot 1000 \cdot 3000 \cdot 4000 = 24 \cdot 10^{12}$$$ operations.
It is necessary to output the remainder of $$$T$$$ when divided by $$$10^9 + 7$$$, which equals $$$999832007$$$.
| Name |
|---|


