import scala.io.Source

object Main extends App {
  val in = Source.stdin.getLines
  for (n <- in if n != "0") {
    val lines = in.take(n.toInt)
    println(lines.foldLeft(1, 2, 3, 1)(roll)._4)
  }

  def roll(value: (Int, Int, Int, Int), op: String): (Int, Int, Int, Int) = {
    val top = value._1
    val front = value._2
    val side = value._3
    val sum = value._4
    op match {
      case "North" => (front, 7 - top, side, sum + front)
      case "East" => (7 - side, front, top, sum + 7 - side)
      case "West" => (side, front, 7 - top, sum + side)
      case "South" => (7 - front, top, side, sum + 7 - front)
      case "Right" => (top, side, 7 - front, sum + top)
      case "Left" => (top, 7 - side, front, sum + top)
    }
  }
}

