while true
  m = gets.to_i
  if m == 0
    break
  end

  u = 1
  n = 5
  s = 2
  e = 3
  w = 4
  d = 6

  sum = 1
  i = 0
  while i < m
    x = gets.chomp
    case x
    when "North"
      t = u
      u = s
      s = d
      d = n
      n = t

    when "East"
      t = u
      u = w
      w = d
      d = e
      e = t

    when "West"
      t = u
      u = e
      e = d
      d = w
      w = t

    when "South"
      t = u
      u = n
      n = d
      d = s
      s = t

    when "Right"
      t = s
      s = e
      e = n
      n = w
      w = t

    when "Left"
      t = s
      s = w
      w = n
      n = e
      e = t
    end
    sum += u
    i += 1
  end

  puts sum
end