class Dice
    TOP = 0; BOTTOM = 1; NORTH = 2; SOUTH = 3; EAST = 4; WEST = 5;

    attr_reader :dice
    def initialize
        @dice = Array.new(6)
        @dice[TOP] = 1
        @dice[BOTTOM] = 6
        @dice[NORTH] = 5
        @dice[SOUTH] = 2
        @dice[EAST] = 3
        @dice[WEST] = 4
    end

    def north
        tmp = @dice.dup
        tmp[TOP] = @dice[SOUTH]
        tmp[SOUTH] = @dice[BOTTOM]
        tmp[BOTTOM] = @dice[NORTH]
        tmp[NORTH] = @dice[TOP]
        @dice = tmp
    end

    def east
        tmp = @dice.dup
        tmp[TOP] = @dice[WEST]
        tmp[WEST] = @dice[BOTTOM]
        tmp[BOTTOM] = @dice[EAST]
        tmp[EAST] = @dice[TOP]
        @dice = tmp
    end

    def west
        tmp = @dice.dup
        tmp[TOP] = @dice[EAST]
        tmp[EAST] = @dice[BOTTOM]
        tmp[BOTTOM] = @dice[WEST]
        tmp[WEST] = @dice[TOP]
        @dice = tmp
    end

    def south
        tmp = @dice.dup
        tmp[TOP] = @dice[NORTH]
        tmp[NORTH] = @dice[BOTTOM]
        tmp[BOTTOM] = @dice[SOUTH]
        tmp[SOUTH] = @dice[TOP]
        @dice = tmp
    end

    def right
        tmp = @dice.dup
        tmp[SOUTH] = @dice[EAST]
        tmp[EAST] = @dice[NORTH]
        tmp[NORTH] = @dice[WEST]
        tmp[WEST] = @dice[SOUTH]
        @dice = tmp
    end

    def left
        tmp = @dice.dup
        tmp[SOUTH] = @dice[WEST]
        tmp[WEST] = @dice[NORTH]
        tmp[NORTH] = @dice[EAST]
        tmp[EAST] = @dice[SOUTH]
        @dice = tmp
    end

    def print_r
#        p @dice
    end
end

while true
    n = gets.to_i
    exit if n==0

    d = Dice.new

    res = 1
    n = gets.to_i
    n.times do
        l = gets.chomp
        d.send l.downcase
        res += d.dice[Dice::TOP]
        d.print_r
    end

    puts res
end