import Control.Monad (replicateM)
import Data.List (foldl')

type Dice = (Int,Int,Int) -- (top,south,east)
type Command = String

main = do
    n <- readLn
    if n == 0 then return () else do
        cmds <- replicateM n getLine
        print $ solve cmds
        main

solve :: [Command] -> Int
solve cmds = solve' cmds 1 (1,2,3)
    where
    solve' [] acc dice = acc
    solve' (cmd:cmds) acc dice = solve' cmds (acc+a') dice'
        where
        dice'@(a',_,_) = operate cmd dice

operate :: Command -> Dice -> Dice
operate "North" (a,b,c) = (b,7-a,c)
operate "East"  (a,b,c) = (7-c,b,a)
operate "West"  (a,b,c) = (c,b,7-a)
operate "South" (a,b,c) = (7-b,a,c)
operate "Right" (a,b,c) = (a,c,7-b)
operate "Left"  (a,b,c) = (a,7-c,b)