object Main {
  def main(args: Array[String]): Unit = {
    val Array(_1, _2, _3, _4, _5, _6, _*) = io.StdIn.readLine().split(" ").map(_.toInt)
    val dice = Dice(_1, _2, _3, _4, _5, _6)
    println(
      io.StdIn.readLine().foldLeft(dice) { case (d, c) => d.roll(Direction(c)) }.upSide
    )
  }

  case class Dice(upSide: Int, southSide: Int, eastSide: Int, westSide: Int, northSide: Int, downSide: Int) {
    import Direction._
    def spinClockwise: Dice = Dice(upSide, eastSide, northSide, southSide, westSide, downSide)
    def spinCounterclockwise: Dice = Dice(upSide, westSide, southSide, northSide, eastSide, downSide)
    def roll(direction: Direction): Dice = direction match {
      case North =>
        Dice(southSide, downSide, eastSide, westSide, upSide, northSide)
      case South =>
        Dice(northSide, upSide, eastSide, westSide, downSide, southSide)
      case West =>
        Dice(eastSide, southSide, downSide, upSide, northSide, westSide)
      case East =>
        Dice(westSide, southSide, upSide, downSide, northSide, eastSide)
    }
  }

  sealed trait Direction
  object Direction {
    case object North extends Direction
    case object South extends Direction
    case object West extends Direction
    case object East extends Direction

    def apply(c: Char): Direction = c match {
      case 'N' => North
      case 'S' => South
      case 'E' => East
      case 'W' => West
      case _ => throw new Exception
    }
  }
}