#include <bits/stdc++.h>

using namespace std;

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

class Cube {
public:
    int f[6];

    Cube() {}

    void roll_z() { roll(1, 2, 4, 3); }//
    void roll_y() { roll(0, 2, 5, 3); }//
    void roll_x() { roll(0, 1, 5, 4); }//
    void roll(int i, int j, int k, int l) {
        int t = f[i];
        f[i] = f[j];
        f[j] = f[k];
        f[k] = f[l];
        f[l] = t;
    };

    void move(char ch) {
        if (ch == 'E') REP(i, 3) roll_y();
        if (ch == 'W') roll_y();
        if (ch == 'N') roll_x();
        if (ch == 'S') REP(i, 3) roll_x();
    }
};

int main() {
    Cube c;
    string com;

    REP(i, 6) cin >> c.f[i];
    cin >> com;

    REP(i, com.size()) c.move(com[i]);
    cout << c.f[0] << endl;
}