Jasiek is only 6 years old, but he already shows numerous talents. He really likes to draw and solve puzzles. This morning, he received a piece of grid paper and a pencil from his mom, and he eagerly started drawing. All of Jasiek's drawings share certain characteristics:
- Jasiek colors in full grid squares;
- if two colored squares touch, they share a side or a corner;
- they are connected, which means that between any two colored squares, there exists a sequence of colored squares where every two consecutive squares share a side;
- there are no white holes, meaning that from any white square, one can draw a line to the edge of the paper that never touches any colored square.
At noon, his mom called and asked what today's drawing represented. The little boy did not answer directly, but instead described the drawing by providing a sequence of moves needed to traverse the colored squares on the boundary of the drawing, i.e., those that share at least one corner with a white square. Jasiek determined a starting square and then provided a sequence of directions in which one must move to traverse the entire drawing. It is known that Jasiek described the drawing in a counter-clockwise direction. His mom was greatly surprised by the complexity of the drawing, and in particular by the number of colored squares. Could you, based on Jasiek's description, quickly calculate how many colored squares are in the drawing?
Task
Write a program that:
- reads (from standard input) the description of Jasiek's drawing,
- calculates the number of all colored squares,
- prints the result (to standard output).
Input
The input consists of a series of lines, each containing only one character. The first line contains the uppercase letter P, and the last line contains the uppercase letter K. The letter P denotes the beginning of the description, and the letter K denotes its end. Each of the remaining lines (if any) contains one letter N, W, S, or E, where N stands for north, W for west, S for south, and E for east. Each line of the input corresponds to a square on the boundary of the drawing. The first and last lines correspond to the same square, where the description starts and ends. The letter in a line other than the first and last indicates the direction to move to reach the next boundary square when traversing the drawing counter-clockwise. Jasiek's description is not redundant, i.e., it ends after traversing the entire drawing and returning to the starting square. The length of the description never exceeds $20\,000$ letters.
Output
Your program should print (to standard output) only one line with a single integer equal to the number of colored squares in Jasiek's drawing.
Examples
Input 1
P S S S E N E E S E E N N N N S S S W W N N W W W N S K
Output 1
23