Justin is playing a chess puzzle minigame!
In this minigame, you start with ~N~ points. Based on if he solves the current puzzle or not, he will gain or lose score.
For each problem that Justin solves correctly, he gains ~1~ point. However, if he gets the problem wrong, he loses ~3~ points.
In this puzzle minigame, there is also a streak, which gives you bonus points if you solve some amount of problems correct in a row. If Justin manages to hit the streak, which is done by solving ~M~ problems in a row, he gains ~K~ points and his streak resets to ~0~. Otherwise, if he gets a problem wrong, his streak also resets to ~0~ and he gets no bonus points from the streak.
Justin is planning to solve ~Q~ problems in total, but he may not be able to, if he runs out of points before he solves all the puzzles. Given ~Q~ results, either
AC for a solved puzzle or
WA for an incorrect solve, figure out how many points he will end with, or if he loses all of his points(~0~ or negative values) before the ~Q~ puzzles, he gets ~0~ score.
The first line will contain 3 integers ~N~, ~Q~, ~M~ and ~K~, representing the number of points you start off with, the number of puzzles, the streak value, and the bonus points you get for hitting a specific streak, respectively. It is guaranteed that all of these values will be between ~1~ and ~10^3~.
Output one integer, the number of points that Justin ends with after doing the ~Q~ puzzles, or ~0~ if he loses all of his points before solving all of them.
Sample Input 1
65 5 5 5 AC AC AC AC AC
Sample Output 1
Justin starts off with ~65 points~, and he solved ~5~ problems, so he gets ~1~ point for each of them. However, he also hits the streak of ~5~, so he gains ~5~ points, totaling up to ~75 points~.
Sample Input 2
1 7 5 6 AC AC AC AC WA WA AC
Sample Output 2
Sample Explanation 2
Justin started off with ~1~ point, solved ~4~ problems, so he has ~5~ points. However, he got ~2~ wrong, so he loses ~6~ points, thus going into negatives. Because of this, we print ~0~.