#include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

class dice{
  int* me;
public:
  dice(int me_[6]){
    me = me_;
  }
  int Top(){
    return me[0];
  }
  void East(){
    swap(me[0], me[3]);
    swap(me[3], me[5]);
    swap(me[5], me[2]);
  }
  void West(){
    swap(me[0], me[2]);
    swap(me[2], me[5]);
    swap(me[5], me[3]);
  }
  void North(){
    swap(me[0], me[1]);
    swap(me[1], me[5]);
    swap(me[5], me[4]);
  }
  void South(){
    swap(me[0], me[4]);
    swap(me[4], me[5]);
    swap(me[5], me[1]);
  }
};


int main(){ _;
  int me[6];
  REP(i,6) cin>>me[i];
  dice d{me};
  char c;
  while(cin>>c){
    if(c=='E'){
      d.East();
    }else if(c=='W'){
      d.West();
    }else if(c=='N'){
      d.North();
    }else if(c=='S'){
      d.South();
    }
  }
  cout<<d.Top()<<endl;
}
#include<iostream>
#include<string>
using namespace std;

struct dice{
	int top;
	int front;
	int left;
	int right;
	int back;
	int bottom;
};

int main(){
	//????????????????????¢?????°????????\?????????
	struct dice X;
	cin >> X.top;
	cin >> X.front;
	cin >> X.right;
	cin >> X.left;
	cin >> X.back;
	cin >> X.bottom;
	//?????¢??????????????\?????????
	string Rotation;
	cin >> Rotation;
	//????????????????????¢?????????
	for(int i = 0; i < Rotation.size(); i++){
		if(Rotation[i] == 'N'){
			struct dice Y;
			Y.top    = X.front;
			Y.front  = X.bottom;
			Y.left   = X.left;
			Y.right  = X.right;
			Y.back   = X.top;
			Y.bottom = X.back;
			X = Y;
		}
		if(Rotation[i] == 'E'){
			struct dice Y;
			Y.top    = X.left;
			Y.front  = X.front;
			Y.left   = X.bottom;
			Y.right  = X.top;
			Y.back   = X.back;
			Y.bottom = X.right;
			X = Y;
		}
		if(Rotation[i] == 'S'){
			for(int j = 0; j < 3; j++){
				struct dice Y;
				Y.top    = X.front;
				Y.front  = X.bottom;
				Y.left   = X.left;
				Y.right  = X.right;
				Y.back   = X.top;
				Y.bottom = X.back;
				X = Y;
			}
		}
		if(Rotation[i] == 'W'){
			for(int j = 0; j < 3; j++){
				struct dice Y;
				Y.top    = X.left;
				Y.front  = X.front;
				Y.left   = X.bottom;
				Y.right  = X.top;
				Y.back   = X.back;
				Y.bottom = X.right;
				X = Y;
			}
		}
	}
	//?????¢??????????????¨?????????
	cout << X.top << endl;
	return 0;
}