#include <iostream>
#include <string>
using namespace std;
class Dice{
public:
    int n1,n2,n3,n4,n5,n6;
    
    void East(){
        int t = n1;
        n1 = n4;
        n4 = n6;
        n6 = n3;
        n3 = t;
    }
    void West(){
        int t = n1;
        n1 = n3;
        n3 = n6;
        n6 = n4;
        n4 = t;
    }
    void South(){
        int t=n1;
        n1 = n5;
        n5 = n6;
        n6 = n2;
        n2 = t;
    }
    void North(){
        int t=n1;
        n1 = n2;
        n2 = n6;
        n6 = n5;
        n5 = t;
    }
};

int main() {
    Dice dice;
    int n1, n2, n3, n4, n5, n6;
    char ch;
    cin >> n1 >> n2 >> n3 >> n4 >> n5 >> n6;
    dice.n1 = n1;
    dice.n2 = n2;
    dice.n3 = n3;
    dice.n4 = n4;
    dice.n5 = n5;
    dice.n6 = n6;
    while(cin >> ch){
        if(ch=='E'){
            dice.East();
        }
        else if(ch=='W'){
            dice.West();
        }
        else if(ch=='S'){
            dice.South();
        }
        else if(ch=='N'){
            dice.North();
        }
    }
    cout << dice.n1 << endl;
    return 0;
}
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

string str;
int ans;

class dice{
public:
	int n[6];
	void E(){
		int t = n[0];
		n[0] = n[3];
		n[3] = n[5];
		n[5] = n[2];
		n[2] = t;
	}
	void W(){
		int t = n[0];
		n[0] = n[2];
		n[2] = n[5];
		n[5] = n[3];
		n[3] = t;
	}
	void S(){
		int t = n[0];
		n[0] = n[4];
		n[4] = n[5];
		n[5] = n[1];
		n[1] = t;
	}
	void N(){
		int t = n[0];
		n[0] = n[1];
		n[1] = n[5];
		n[5] = n[4];
		n[4] = t;
	}
};


int main(){
	dice d;
	rep(i, 6) cin >> d.n[i];
	cin >> str;
	ans = d.n[0];
	rep(i, str.length()){
		switch (str[i])
		{
		case 'E':
			d.E();
			break;
		case 'W':
			d.W();
			break;
		case 'S':
			d.S();
			break;
		case 'N':
			d.N();
			break;
		default:
			break;
		}
	}
	cout << d.n[0] << endl;
	return 0;
}