#include<iostream>
#include<string>

using namespace std;

int main()
{
    string line;
    int m[6];
    int top=1,n=5,e=3;
    for(int i=0;i<6;i++) cin >> m[i];
    cin >> line;
    for(int i=0;i<(int)line.size();i++){
        int t=top;
        if(line[i]=='N'){
            top=7-n;
            n=t;
        }
        else if(line[i]=='S'){
            top=n;
            n=7-t;
        }
        else if(line[i]=='E'){
            top=7-e;
            e=t;
        }
        else{
            top=e;
            e=7-t;
        }

    }
    cout << m[top-1] << endl;
    return 0;
}

