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

main = do
    n <- readLn
    if n == 0 then return () else do
        proc n 1 (1,2,3)
        main

proc 0 acc _    = print acc
proc n acc dice = do
    cmd <- getLine
    let
        dice'@(a',_,_) = operate cmd dice
    proc (n-1) (acc+a') 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)