Black and White Stones

No attempts yetTime limit3sMemory limit256 MB

Problem

Shagga and Dolf play a game with stones. Every stone is either black or white. Dolf opens the game by laying all the stones in one line from left to right, and Shagga then has to reorder them so that every black stone sits to the left of every white stone.

Shagga has exactly one move. He picks two stones of different colors, swaps their positions, and pays Dolf AA coins for it. If the two swapped stones were next to each other, Dolf refunds BB coins, so that swap costs Shagga only ABA - B coins.

Shagga has not worked out that he only loses coins by playing this game. He does know that playing well loses fewer coins than his current habit of picking the two stones at random. Find the smallest number of coins Shagga has to pay Dolf to reach an arrangement where every black stone is to the left of every white stone.

Input

The first line contains two integers AA and BB (0B<A1060 \le B < A \le 10^6). AA is the price of one swap and BB is the refund for swapping two neighboring stones.

The second line contains a non-empty string SS of at most 50005000 characters. The ii-th character of SS gives the color of the ii-th stone from the left in the starting line. The character B marks a black stone and the character W marks a white stone.

Output

Print one integer on a single line: the smallest number of coins Shagga has to pay Dolf to arrange the stones so that every black stone is to the left of every white stone.