class Dice
  def initialize
    @face = 1
    @north = 5
    @south = 2
    @west = 4
    @east = 3
  end
  def move_north
  @north,@face,@south = @face,@south,7-@face
  @face
  end
  def move_south
  @south,@face,@north = @face,@north,7-@face
  @face
  end
  def move_west
  @west,@face,@east = @face,@east,7-@face
  @face
  end
  def move_east
  @east,@face,@west = @face,@west,7-@face
  @face
  end
  def move_right
  @north,@west,@south,@east = @west,@south,@east,@north
  @face
  end
  def move_left
  @west,@south,@east,@north = @north,@west,@south,@east
  @face
  end
end

until (n = gets.chomp.to_i) == 0 ? true:false
  dice = Dice.new
  count = 1
  n.times do
    count += case order = gets.chomp
               when "North"
                  dice.move_north
               when "South"
                  dice.move_south
               when "East"
                  dice.move_east
               when "West"
                  dice.move_west
               when "Left"
                  dice.move_left
               when"Right"
                  dice.move_right
              end
  end
  p count
end