import Control.Monad

main = do
  n <- readLn
  unless (n == 0) $ do
    w <- replicateM n getLine
    print $ sum $ map head $ scanl roll [1,2,3] w
    main

roll [u,f,r] s
  | s == "North" = [f,7-u,r]
  | s == "East"  = [7-r,f,u]
  | s == "West"  = [r,f,7-u]
  | s == "South" = [7-f,u,r]
  | s == "Right" = [u,r,7-f]
  | otherwise    = [u,7-r,f]