#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <cassert>
using namespace std;

enum class Direction { North, East, West, South, };

struct Faces {
  int top;
  int front;
  int right;
  int left;
  int back;
  int bottom;

  Faces(const int t, const int f, const int r, const int l, const int ba, const int bo):
    top(t), front(f), right(r), left(l), back(ba), bottom(bo) {}
};

bool operator==(const Faces& lval, const Faces& rval) {
  return
    lval.top == rval.top &&
    lval.front == rval.front &&
    lval.right == rval.right &&
    lval.left == rval.right &&
    lval.back == rval.back &&
    lval.bottom == rval.bottom;
}

class Dice {
private:
  Faces faces_;
public:
  Dice(const Faces& faces):
    faces_(faces) {}

  Dice rotate_to(const Direction direction) {
    const Faces faces = [&](Direction direction) {
                          switch (direction) {
                          case Direction::North:
                            // cout << "rotate_North" << endl;
                           return Faces(faces_.front, faces_.bottom, faces_.right, faces_.left, faces_.top, faces_.back);
                          case Direction::East:
                            // cout << "rotate_East" << endl;
                            return Faces(faces_.left, faces_.front, faces_.top, faces_.bottom, faces_.back, faces_.right);
                          case Direction::West:
                            // cout << "rotate_West" << endl;
                            return Faces(faces_.right, faces_.front, faces_.bottom, faces_.top, faces_.back, faces_.left);
                          case Direction::South:
                            // cout << "rotate_South" << endl;
                            return Faces(faces_.back, faces_.top, faces_.right, faces_.left, faces_.bottom, faces_.front);
                          default:
                            // cout << direction << endl;
                            assert("Invalid Direction.");
                          }
                        }(direction);
    return Dice(faces);
  }

  Faces faces() const {
    return this->faces_;
  }

  int top() const {
    return this->faces_.top;
  }

};

Dice make_dice_from_input() {
  int top,front,right,left,back,bottom;
  cin >> top >> front >> right >> left >> back >> bottom;
  Faces faces(top, front, right, left, back, bottom);
  Dice dice(faces);
  return dice;
}

Direction to_direction(const char& c) {
  Direction d = Direction::North;
  switch (c) {
  case 'N':
    // cout << "to_North" << endl;
    d = Direction::North;
    break;
  case 'E':
    // cout << "to_East" << endl;
    d = Direction::East;
    break;
  case 'W':
    // cout << "to_West" << endl;
    d = Direction::West;
    break;
  case 'S':
    // cout << "to_South" << endl;
    d = Direction::South;
    break;
  default:
    // cout << c << endl;
    assert("Invalid Direction Char.");
  }
  return d;
}

int main() {
  Dice dice = make_dice_from_input();
  string directions;
  cin >> directions;
  for (const char& direct : directions) {
    Direction d = to_direction(direct);
    dice = dice.rotate_to(d);
  }
  cout << dice.top() << endl;
  return 0;
}



Measured memory_bytes: 3188