Flipped Course


Phoebe volunteered to navigate the kayaking event because, in her words, "a map is just a very small grid." After arriving nowhere near the finish line, she admits that she held the map upside down for exactly one nonempty consecutive section of the course. She cannot remember when she turned it over, but she is quite sure this explains everything.

The kayak starts at coordinates (0,0)(0, 0). The intended course consists of NN moves, each one metre north, south, east, or west. During the section when the map was upside down, each move was taken in the opposite direction: north became south, south became north, east became west, and west became east. All moves outside that section were taken correctly, and the moves were always performed in their original order.

Given the intended course and the kayak's actual finishing coordinates (X,Y)(X, Y), count how many sections could explain the result. A section is identified by its first and last move, so two sections are different if either endpoint differs. If no section could produce the given finish, output 0.

Input

The first line contains an integer NN (1≤N≤1×1061 \le N \le 1 \times 10^6), the number of moves.

The second line contains a string SS of length NN, describing the intended moves in order:

  • N increases the yy-coordinate by 11.
  • S decreases the yy-coordinate by 11.
  • E increases the xx-coordinate by 11.
  • W decreases the xx-coordinate by 11.

The third line contains two integers XX and YY (−N≤X,Y≤N-N \le X, Y \le N), the actual finishing coordinates.

Output

Print a single integer: the number of nonempty consecutive sections for which taking every move in the opposite direction would make the kayak finish at (X,Y)(X, Y).

Example 1

Input 1
4
NSNS
0 0
Output 1
4
Explanation

The possible sections are moves 11 to 22, 22 to 33, 33 to 44, and 11 to 44. Each has zero net displacement, so reversing its directions leaves the finish unchanged. The empty section is not allowed and is not counted.

Example 2

Input 2
1
E
-1 0
Output 2
1
Explanation

The only nonempty section is the entire course. Reversing its one move takes the kayak west instead of east.

Example 3

Input 3
2
NE
0 0
Output 3
0
Explanation

Reversing only the first move finishes at (1,−1)(1, -1), reversing only the second finishes at (−1,1)(-1, 1), and reversing both finishes at (−1,−1)(-1, -1). None reaches (0,0)(0, 0).

Comments0


No comments yet

Be the first to comment.

New comment


Log in to join the discussion.