import scala.io.StdIn
/**
  * AOJ
  */

object Main {

  def main(args: Array[String]): Unit = {

    val dice = StdIn.readLine().split(" ").map(_.toInt)
    val commands = StdIn.readLine().toCharArray
    println(commands.foldLeft(dice){(x,y) => getNextStatus(y,x)}(0))
  }

  def getNextStatus(cmd:Char,dice:Array[Int]): Array[Int] = cmd
    match {
      case 'E' => Array(dice(3),dice(1),dice(0),dice(5),dice(4),dice(2))
      case 'N' => Array(dice(1),dice(5),dice(2),dice(3),dice(0),dice(4))
      case 'S' => Array(dice(4),dice(0),dice(2),dice(3),dice(5),dice(1))
      case 'W' => Array(dice(2),dice(1),dice(5),dice(0),dice(4),dice(3))
    }
}