import Control.Monad

type Dice = (Int,Int,Int,Int,Int,Int)

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

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

getTop :: Dice -> Int
getTop (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)