#include <bits/stdc++.h>
#define TOP 0
#define FRONT 1
#define RIGHT 2
#define LEFT 3
#define BACK 4
#define BOTTOM 5
using namespace std;

int dice[6] = {1,2,3,4,5,6};

void rotN(){
  swap(dice[TOP], dice[BACK]);
  swap(dice[TOP], dice[BOTTOM]);
  swap(dice[TOP], dice[FRONT]);
}

void rotE(){
  swap(dice[TOP], dice[RIGHT]);
  swap(dice[TOP], dice[BOTTOM]);
  swap(dice[TOP], dice[LEFT]);
}

void rotS(){
  rotN(), rotN(), rotN();
}

void rotW(){
  rotE(), rotE(), rotE();
}

int main(){
cin >> dice[TOP]>> dice[FRONT]>> dice[RIGHT]>> dice[LEFT]>> dice[BACK]>> dice[BOTTOM];
string str;
cin >> str;
for(int i = 0; i < str.size(); i++){
  if(str[i] == 'N') rotN();
  if(str[i] == 'S') rotS();
  if(str[i] == 'W') rotW();
  if(str[i] == 'E') rotE();
}
cout << dice[TOP] << endl;
}
