#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
using namespace std;

class dice{
public:
    int top, bottom, right, left, front, back;
    void North();
    void East();
    void South();
    void West();
};
void dice:: North(){
    int tmp = top;
    top = front;
    front = bottom;
    bottom = back;
    back = tmp;
}
void dice:: East(){
    int tmp = top;
    top = left;
    left = bottom;
    bottom = right;
    right = tmp;
}
void dice:: South(){
    int tmp = top;
    top = back;
    back = bottom;
    bottom = front;
    front = tmp;
}
void dice:: West(){
    int tmp = top;
    top = right;
    right = bottom;
    bottom = left;
    left = tmp;
}

signed main(){
    dice d;
    cin >> d.top >> d.front >> d.right >> d.left >> d.back >> d.bottom;
    string s;
    cin >> s;
    rep(i, 0, s.size()){
        // switch (s[i]){
            // case 'N': d.North();
            //case 'E': d.East();
            //case 'S': d.South();
            //case 'W': d.West();
        if(s[i] == 'N') d.North();
        else if(s[i] == 'E') d.East();
        else if(s[i] == 'S') d.South();
        else if(s[i] == 'W') d.West();
           // cout << d.top << endl;
    }
    cout << d.top << endl;
}
#include<iostream>
#include<cstdio>
using namespace std;
int main() {
	int siz[6], damy;
	char mozi[2];
	for (int abc = 0; abc < 6; abc++) {
		cin >> siz[abc];
	}
	fgets(mozi,2,stdin);
	while(true){
		fgets(mozi,2,stdin);
		if (mozi[0] == '\n') {
			cout << siz[0] << endl;
			break;
		}
		switch (mozi[0]) {
		case 'S':
			damy = siz[0];
			siz[0] = siz[4];
			siz[4] = siz[5];
			siz[5] = siz[1];
			siz[1] = damy;
			break;
		case 'E':
			damy = siz[0];
			siz[0] = siz[3];
			siz[3] = siz[5];
			siz[5] = siz[2];
			siz[2] = damy;
			break;
		case 'N':
			damy = siz[0];
			siz[0] = siz[1];
			siz[1] = siz[5];
			siz[5] = siz[4];
			siz[4] = damy;
			break;
		case 'W':
			damy = siz[0];
			siz[0] = siz[2];
			siz[2] = siz[5];
			siz[5] = siz[3];
			siz[3] = damy;
			break;
		}
	}
	return 0;
}