class Dice
  def init
    @up_value    = 1
    @front_value = 2
    @right_value = 3
    @left_value  = 4
    @back_value  = 5
    @down_value  = 6
  end

  def move_north
    tmp = [@front_value, @up_value, @back_value, @down_value]
    @up_value, @back_value, @down_value, @front_value = tmp
  end

  def move_east
    tmp = [@left_value, @up_value, @right_value, @down_value]
    @up_value, @right_value, @down_value, @left_value = tmp
  end

  def move_west
    tmp = [@right_value, @up_value, @left_value, @down_value]
    @up_value, @left_value, @down_value, @right_value = tmp
  end

  def move_south
    tmp = [@back_value, @up_value, @front_value, @down_value]
    @up_value, @front_value, @down_value, @back_value = tmp
  end

  def move_right
    tmp = [@right_value, @front_value, @left_value, @back_value]
    @front_value, @left_value, @back_value, @right_value = tmp
  end

  def move_left
    tmp = [@left_value, @front_value, @right_value, @back_value]
    @front_value, @right_value, @back_value, @left_value = tmp
  end
end

dice = Dice.new
array = []

while (num = gets.to_i) != 0 do
  sum = 0
  num.times do
    operation = gets.chomp
    case operation
    when "North"
      dice.move_north
    when "East"
      dice.move_east
    when "West"
      dice.move_west
    when "South"
      dice.move_south
    when "Right"
      dice.move_right
    when "Left"
      dice.move_left
    end
  sum += dice.up_value
  end
  array << sum
end

puts array