L. Kim Possible and the Mooks and the Swappinator
time limit per test
2 seconds
memory limit per test
512 megabytes
input
standard input
output
standard output

Kim Possible has infiltrated Dr. Drakken's lair again and has to fight off some MOOKS and MEEKS in order to stop him from his evil schemes.

Like last time, Dr. Drakken knew Team Possible was coming for him as they always have. So he prepared a magical scientific device to strengthen his army of MOOKS and MEEKS.

All the MOOKS and MEEKS form a straight line and Kim Possible has to fight them starting from the first one. The MEEKS don't fight because they are tired, but the MOOKS take Kim one minute to defeat. Whenever Kim Possible defeats a MOOK, the MOOK will use his McGuffin which drains all of his energy and throws Kim Possible back to the start of the line. All the MEEKS in front of the MOOK get re-energized and turn back into MOOKS with their McGuffin fully recharged, but the MOOK that used his McGuffin turns into a MEEK, fully drained of energy.

This time however, Team Possible was more prepared and the scientific genius Wade provided Kim Possible with a device called the Swappinator. The Swappinator can swap the positions of any two distinct opponents of Kim Possible and can be used $$$k$$$ times.

Given the initial line of MOOKS and MEEKS and the optimal use of the swappinator, how many minutes will it take for Kim Possible to defeat all the MOOKS and turn them into MEEKS? Note that the Swappinator must be used exactly $$$k$$$ times and must be used before any attacks.

Output the answer mod $$$10^9$$$.

Input

The input is composed of two lines. The first line contains two integers $$$n$$$ and $$$k$$$, the number of MOOKS/MEEKS and the number of times Team Possible can use the Swappinator, respectively. $$$n$$$ lines follow, each is either a MOOK or a MEEK, describing their order in their line.

Constraints

$$$0 \leq k \leq n$$$

$$$2 \leq n \leq 10^5$$$

Output

For each test case, output a single integer which is the shortest amount of time, in minutes and in mod $$$10^9$$$, before Kim possible defeats all MOOKS.

Examples
Input
3 0
MEEK
MOOK
MEEK
Output
2
Input
3 1
MEEK
MOOK
MEEK
Output
1
Input
7 1
MOOK
MEEK
MEEK
MOOK
MEEK
MOOK
MEEK
Output
11
Input
7 3
MOOK
MEEK
MEEK
MOOK
MEEK
MOOK
MEEK
Output
7