Jung-in works as the doorman of a famous club. The club owner wants the number of men and women inside the club to stay roughly balanced whenever the club is full.
Guests line up in a single queue before the club opens. Once the doors open, Jung-in lets them in one at a time. By default he admits people in the order they are standing, but at his own discretion he may let the person standing second in line enter before the person standing first. (He may not let anyone further back than the first person cut ahead.) Reordering people like this might annoy whoever was skipped, but Jung-in never loses a fight, so he does not worry about it.
Jung-in must always keep track of the absolute difference between the number of men and the number of women currently inside the club. If admitting a guest would make this difference exceed the largest value $X$ that Jung-in can remember, that guest cannot enter. Using the reordering described above, Jung-in wants to admit as many guests as possible. Once he can no longer admit anyone (no matter how he reorders), none of the remaining guests can enter.
Given the order of people in line and the maximum difference $X$ that Jung-in can remember, write a program that finds the maximum number of guests that can enter the club.
The first line contains an integer $X$ ($0 \le X < 100$), the largest difference Jung-in can remember. The second line contains a string describing the order of the queue. The string consists only of W (woman) and M (man) and has length at most $100$. The leftmost character is the gender of the person at the very front of the line.
Print the maximum number of guests that can enter the club.