import scala.math.{min,max}

object Main {
  val sc = new java.util.Scanner(System.in)
  def roll(s: String, a: Array[Int]) = s match {
    case "North" => Array(a(1), a(5), a(2), a(3), a(0), a(4))
    case "East" => Array(a(3), a(1), a(0), a(5), a(4), a(2))
    case "West" => Array(a(2), a(1), a(5), a(0), a(4), a(3))
    case "South" => Array(a(4), a(0), a(2), a(3), a(5), a(1))
    case "Right" => Array(a(0), a(2), a(4), a(1), a(3), a(5))
    case "Left" => Array(a(0), a(3), a(1), a(4), a(2), a(5))
  }
  def main(args: Array[String]) {
    while(true) {
      val n = sc.nextInt
      if(n == 0) return
      var a = (1 to 6).toArray
      var ans = 1
      for(i <- 1 to n) {
        a = roll(sc.next, a)
        ans += a(0)
      }
      println(ans)
    }
  }
}