while 1:

  n = eval(input())

  if n == 0:  break

  d = list(range(1, 7))

  ans = 1

  for i in range(n):

    c = input()[0]

    if c == 'N': S = [1,5,2,3,0,4]

    elif c == "S": S = [4,0,2,3,5,1]

    elif c == "E": S = [3,1,0,5,4,2]

    elif c == "W": S = [2,1,5,0,4,3]

    elif c == "R": S = [0,2,4,1,3,5]

    elif c == "L": S = [0,3,1,4,2,5]

    d = [d[s] for s in S]

    ans += d[0]

  print(ans)
import sys

  

operator = sys.stdin.read().split()

      

top = 1

bottom = 6

south = 2

north = 5

east = 3

west = 4

sum = 1

  

for var in operator[1:]:

    if var == "North":

        north,top,south,bottom = top,south,bottom,north

        sum += top

    elif var == "South":

        south,top,north,bottom = top,north,bottom,south

        sum += top

    elif var == "West":

        west,top,east,bottom = top,east,bottom,west

        sum += top

    elif var == "East":

        east,top,west,bottom = top,west,bottom,east

        sum += top

    elif var == "Right":

        south,east,north,west = east,north,west,south

        sum += top

    elif var == "Left":

        south,west,north,east = west,north,east,south

        sum += top

    else:

        print(sum)

        top = 1

        bottom = 6

        south = 2

        north = 5

        east = 3

        west = 4

        sum = 1
while 1:
    n = eval(input())
    if n == 0:
        break
    d = list(range(1, 7))
    ans = 1
    for i in range(n):
        c = input()[0]
        if c == "N":
            S = [1, 5, 2, 3, 0, 4]
        elif c == "S":
            S = [4, 0, 2, 3, 5, 1]
        elif c == "E":
            S = [3, 1, 0, 5, 4, 2]
        elif c == "W":
            S = [2, 1, 5, 0, 4, 3]
        elif c == "R":
            S = [0, 2, 4, 1, 3, 5]
        elif c == "L":
            S = [0, 3, 1, 4, 2, 5]
        d = [d[s] for s in S]
        ans += d[0]
    print(ans)

import sys

operator = sys.stdin.read().split()
top = 1
bottom = 6
south = 2
north = 5
east = 3
west = 4
sum = 1
for var in operator[1:]:
    if var == "North":
        north, top, south, bottom = top, south, bottom, north
        sum += top
    elif var == "South":
        south, top, north, bottom = top, north, bottom, south
        sum += top
    elif var == "West":
        west, top, east, bottom = top, east, bottom, west
        sum += top
    elif var == "East":
        east, top, west, bottom = top, west, bottom, east
        sum += top
    elif var == "Right":
        south, east, north, west = east, north, west, south
        sum += top
    elif var == "Left":
        south, west, north, east = west, north, east, south
        sum += top
    else:
        print(sum)
        top = 1
        bottom = 6
        south = 2
        north = 5
        east = 3
        west = 4
        sum = 1

-while 1: -    n = eval(input()) -    if n == 0: -        break -    d = list(range(1, 7)) -    ans = 1 -    for i in range(n): -        c = input()[0] -        if c == "N": -            S = [1, 5, 2, 3, 0, 4] -        elif c == "S": -            S = [4, 0, 2, 3, 5, 1] -        elif c == "E": -            S = [3, 1, 0, 5, 4, 2] -        elif c == "W": -            S = [2, 1, 5, 0, 4, 3] -        elif c == "R": -            S = [0, 2, 4, 1, 3, 5] -        elif c == "L": -            S = [0, 3, 1, 4, 2, 5] -        d = [d[s] for s in S] -        ans += d[0] -    print(ans) +import sys + +operator = sys.stdin.read().split() +top = 1 +bottom = 6 +south = 2 +north = 5 +east = 3 +west = 4 +sum = 1 +for var in operator[1:]: +    if var == "North": +        north, top, south, bottom = top, south, bottom, north +        sum += top +    elif var == "South": +        south, top, north, bottom = top, north, bottom, south +        sum += top +    elif var == "West": +        west, top, east, bottom = top, east, bottom, west +        sum += top +    elif var == "East": +        east, top, west, bottom = top, west, bottom, east +        sum += top +    elif var == "Right": +        south, east, north, west = east, north, west, south +        sum += top +    elif var == "Left": +        south, west, north, east = west, north, east, south +        sum += top +    else: +        print(sum) +        top = 1 +        bottom = 6 +        south = 2 +        north = 5 +        east = 3 +        west = 4 +        sum = 1