using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var numList = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var directList = Console.ReadLine();

            var dice = new Dice(numList);

            foreach (char direction in directList)
            {
                switch (direction)
                {
                    case 'N':
                        dice.Roll(Direction.North);
                        break;

                    case 'E':
                        dice.Roll(Direction.East);
                        break;

                    case 'S':
                        dice.Roll(Direction.South);
                        break;

                    case 'W':
                        dice.Roll(Direction.West);
                        break;
                }
            }

            Console.WriteLine(dice.Top);
        }
    }

    /// <summary>
    /// 方角を示します。
    /// </summary>
    public enum Direction
    {
        North,
        East,
        South,
        West
    }

    class Dice
    {
        private int[,] diceList;

        /// <summary>
        /// 縦方向の末尾のインデックスを取得します。
        /// </summary>
        private int LastIndexY => diceList.GetLength(0) - 1;

        /// <summary>
        /// 横方向の末尾のインデックスを取得します。
        /// </summary>
        private int LastIndexX => diceList.GetLength(1) - 1;

        /// <summary>
        /// サイコロの上面の要素を取得します。
        /// </summary>
        public int Top => diceList[0, 0];

        /// <summary>
        /// サイコロの右面の要素を取得します。
        /// </summary>
        public int Right => diceList[0, 1];

        public Dice(int[] face)
        {
            diceList = new int[4, 4];

            diceList[0, 0] = face[0];
            diceList[1, 0] = face[1];
            diceList[2, 0] = face[5]; //
            diceList[3, 0] = face[4];

            diceList[0, 1] = face[2];
            diceList[0, 2] = face[5]; //
            diceList[0, 3] = face[3];
        }

        /// <summary>
        /// 方角を指定してサイコロを転がします、
        /// </summary>
        public void Roll(Direction direction)
        {
            switch (direction)
            {
                case Direction.North:
                    RollNorth();
                    break;

                case Direction.East:
                    RollEast();
                    break;

                case Direction.South:
                    RollSouth();
                    break;

                case Direction.West:
                    RollWest();
                    break;
            }
        }

        #region Private Method

        private void UpdateXtoY() => diceList[2, 0] = diceList[0, 2];
        private void UpdateYtoX() => diceList[0, 2] = diceList[2, 0];

        /// <summary>
        /// 北方向へ転がします。
        /// </summary>
        private void RollNorth()
        {
            var tmp = diceList[0, 0];

            for (int i = 0; i < LastIndexY; i++)
            {
                diceList[i, 0] = diceList[i + 1, 0];
            }

            diceList[LastIndexY, 0] = tmp;
            UpdateYtoX();
        }

        /// <summary>
        /// 南方向へ転がします。
        /// </summary>
        private void RollSouth()
        {
            var tmp = diceList[LastIndexY, 0];

            for (int i = LastIndexY; i > 0; i--)
            {
                diceList[i, 0] = diceList[i - 1, 0];
            }

            diceList[0, 0] = tmp;
            UpdateYtoX();
        }

        /// <summary>
        /// 東方向へ転がします。
        /// </summary>
        private void RollEast()
        {
            var tmp = diceList[0, LastIndexX];

            for (int i = LastIndexX; i > 0; i--)
            {
                diceList[0, i] = diceList[0, i - 1];
            }

            diceList[0, 0] = tmp;
            UpdateXtoY();
        }

        /// <summary>
        /// 西方向へ転がします。
        /// </summary>
        private void RollWest()
        {
            var tmp = diceList[0, 0];

            for (int i = 0; i < LastIndexX; i++)
            {
                diceList[0, i] = diceList[0, i + 1];
            }

            diceList[0, LastIndexX] = tmp;
            UpdateXtoY();
        }

        #endregion
    }
}



Measured memory_bytes: 18404