import Control.Monad

-- Dice top bottom front depth right left
data Dice = Dice Int Int Int Int Int Int deriving Show

main = do  
  n <- readLn
  unless (n == 0) $
    do
      ss <- replicateM n getLine
      print $ solve ss (Dice 1 6 2 5 3 4) []
      main

move :: Dice -> String -> Dice
move (Dice t b f d r l) "North" = Dice f d b t r l
move (Dice t b f d r l) "South" = Dice d f t b r l
move (Dice t b f d r l) "East" = Dice l r f d t b
move (Dice t b f d r l) "West" = Dice r l f d b t
move (Dice t b f d r l) "Right" = Dice t b r l d f
move (Dice t b f d r l) "Left" = Dice t b l r f d

getTop :: Dice -> Int
getTop (Dice t _ _ _ _ _) = t

solve :: [String] -> Dice -> [Int] -> Int
solve [] dice score = sum (getTop dice : score)
solve (op:rest) dice score = solve rest (move dice op) (getTop dice : score)